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
- }
-}