diff --git a/UnitsNet.Tests/GeneratedCode/SubstanceAmountTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SubstanceAmountTestsBase.g.cs deleted file mode 100644 index 461c1dbdd9..0000000000 --- a/UnitsNet.Tests/GeneratedCode/SubstanceAmountTestsBase.g.cs +++ /dev/null @@ -1,215 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/anjdreas/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\UnitClasses\MyUnit.extra.cs files to add code to generated unit classes. -// Add Extensions\MyUnitExtensions.cs to decorate unit classes with new behavior. -// Add UnitDefinitions\MyUnit.json and run GeneratUnits.bat to generate new units or unit classes. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2007 Andreas Gullberg Larsen (anjdreas@gmail.com). -// https://github.com/anjdreas/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of SubstanceAmount. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class SubstanceAmountTestsBase - { - protected abstract double CentimolesInOneMole { get; } - protected abstract double DecimolesInOneMole { get; } - protected abstract double KilomolesInOneMole { get; } - protected abstract double MicromolesInOneMole { get; } - protected abstract double MillimolesInOneMole { get; } - protected abstract double MolesInOneMole { get; } - protected abstract double NanomolesInOneMole { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentimolesTolerance { get { return 1e-5; } } - protected virtual double DecimolesTolerance { get { return 1e-5; } } - protected virtual double KilomolesTolerance { get { return 1e-5; } } - protected virtual double MicromolesTolerance { get { return 1e-5; } } - protected virtual double MillimolesTolerance { get { return 1e-5; } } - protected virtual double MolesTolerance { get { return 1e-5; } } - protected virtual double NanomolesTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void MoleToSubstanceAmountUnits() - { - SubstanceAmount mole = SubstanceAmount.FromMoles(1); - AssertEx.EqualTolerance(CentimolesInOneMole, mole.Centimoles, CentimolesTolerance); - AssertEx.EqualTolerance(DecimolesInOneMole, mole.Decimoles, DecimolesTolerance); - AssertEx.EqualTolerance(KilomolesInOneMole, mole.Kilomoles, KilomolesTolerance); - AssertEx.EqualTolerance(MicromolesInOneMole, mole.Micromoles, MicromolesTolerance); - AssertEx.EqualTolerance(MillimolesInOneMole, mole.Millimoles, MillimolesTolerance); - AssertEx.EqualTolerance(MolesInOneMole, mole.Moles, MolesTolerance); - AssertEx.EqualTolerance(NanomolesInOneMole, mole.Nanomoles, NanomolesTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, SubstanceAmount.From(1, SubstanceAmountUnit.Centimole).Centimoles, CentimolesTolerance); - AssertEx.EqualTolerance(1, SubstanceAmount.From(1, SubstanceAmountUnit.Decimole).Decimoles, DecimolesTolerance); - AssertEx.EqualTolerance(1, SubstanceAmount.From(1, SubstanceAmountUnit.Kilomole).Kilomoles, KilomolesTolerance); - AssertEx.EqualTolerance(1, SubstanceAmount.From(1, SubstanceAmountUnit.Micromole).Micromoles, MicromolesTolerance); - AssertEx.EqualTolerance(1, SubstanceAmount.From(1, SubstanceAmountUnit.Millimole).Millimoles, MillimolesTolerance); - AssertEx.EqualTolerance(1, SubstanceAmount.From(1, SubstanceAmountUnit.Mole).Moles, MolesTolerance); - AssertEx.EqualTolerance(1, SubstanceAmount.From(1, SubstanceAmountUnit.Nanomole).Nanomoles, NanomolesTolerance); - } - - [Fact] - public void As() - { - var mole = SubstanceAmount.FromMoles(1); - AssertEx.EqualTolerance(CentimolesInOneMole, mole.As(SubstanceAmountUnit.Centimole), CentimolesTolerance); - AssertEx.EqualTolerance(DecimolesInOneMole, mole.As(SubstanceAmountUnit.Decimole), DecimolesTolerance); - AssertEx.EqualTolerance(KilomolesInOneMole, mole.As(SubstanceAmountUnit.Kilomole), KilomolesTolerance); - AssertEx.EqualTolerance(MicromolesInOneMole, mole.As(SubstanceAmountUnit.Micromole), MicromolesTolerance); - AssertEx.EqualTolerance(MillimolesInOneMole, mole.As(SubstanceAmountUnit.Millimole), MillimolesTolerance); - AssertEx.EqualTolerance(MolesInOneMole, mole.As(SubstanceAmountUnit.Mole), MolesTolerance); - AssertEx.EqualTolerance(NanomolesInOneMole, mole.As(SubstanceAmountUnit.Nanomole), NanomolesTolerance); - } - - [Fact] - public void ConversionRoundTrip() - { - SubstanceAmount mole = SubstanceAmount.FromMoles(1); - AssertEx.EqualTolerance(1, SubstanceAmount.FromCentimoles(mole.Centimoles).Moles, CentimolesTolerance); - AssertEx.EqualTolerance(1, SubstanceAmount.FromDecimoles(mole.Decimoles).Moles, DecimolesTolerance); - AssertEx.EqualTolerance(1, SubstanceAmount.FromKilomoles(mole.Kilomoles).Moles, KilomolesTolerance); - AssertEx.EqualTolerance(1, SubstanceAmount.FromMicromoles(mole.Micromoles).Moles, MicromolesTolerance); - AssertEx.EqualTolerance(1, SubstanceAmount.FromMillimoles(mole.Millimoles).Moles, MillimolesTolerance); - AssertEx.EqualTolerance(1, SubstanceAmount.FromMoles(mole.Moles).Moles, MolesTolerance); - AssertEx.EqualTolerance(1, SubstanceAmount.FromNanomoles(mole.Nanomoles).Moles, NanomolesTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - SubstanceAmount v = SubstanceAmount.FromMoles(1); - AssertEx.EqualTolerance(-1, -v.Moles, MolesTolerance); - AssertEx.EqualTolerance(2, (SubstanceAmount.FromMoles(3)-v).Moles, MolesTolerance); - AssertEx.EqualTolerance(2, (v + v).Moles, MolesTolerance); - AssertEx.EqualTolerance(10, (v*10).Moles, MolesTolerance); - AssertEx.EqualTolerance(10, (10*v).Moles, MolesTolerance); - AssertEx.EqualTolerance(2, (SubstanceAmount.FromMoles(10)/5).Moles, MolesTolerance); - AssertEx.EqualTolerance(2, SubstanceAmount.FromMoles(10)/SubstanceAmount.FromMoles(5), MolesTolerance); - } - - [Fact] - public void ComparisonOperators() - { - SubstanceAmount oneMole = SubstanceAmount.FromMoles(1); - SubstanceAmount twoMoles = SubstanceAmount.FromMoles(2); - - Assert.True(oneMole < twoMoles); - Assert.True(oneMole <= twoMoles); - Assert.True(twoMoles > oneMole); - Assert.True(twoMoles >= oneMole); - - Assert.False(oneMole > twoMoles); - Assert.False(oneMole >= twoMoles); - Assert.False(twoMoles < oneMole); - Assert.False(twoMoles <= oneMole); - } - - [Fact] - public void CompareToIsImplemented() - { - SubstanceAmount mole = SubstanceAmount.FromMoles(1); - Assert.Equal(0, mole.CompareTo(mole)); - Assert.True(mole.CompareTo(SubstanceAmount.Zero) > 0); - Assert.True(SubstanceAmount.Zero.CompareTo(mole) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - SubstanceAmount mole = SubstanceAmount.FromMoles(1); - Assert.Throws(() => mole.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - SubstanceAmount mole = SubstanceAmount.FromMoles(1); - Assert.Throws(() => mole.CompareTo(null)); - } - - - [Fact] - public void EqualityOperators() - { - SubstanceAmount a = SubstanceAmount.FromMoles(1); - SubstanceAmount b = SubstanceAmount.FromMoles(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - - [Fact] - public void EqualsIsImplemented() - { - SubstanceAmount v = SubstanceAmount.FromMoles(1); - Assert.True(v.Equals(SubstanceAmount.FromMoles(1))); - Assert.False(v.Equals(SubstanceAmount.Zero)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - SubstanceAmount mole = SubstanceAmount.FromMoles(1); - Assert.False(mole.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - SubstanceAmount mole = SubstanceAmount.FromMoles(1); - Assert.False(mole.Equals(null)); - } - } -} diff --git a/UnitsNet/CustomCode/UnitSystem.cs b/UnitsNet/CustomCode/UnitSystem.cs index e4580e2b59..e0c061249b 100644 --- a/UnitsNet/CustomCode/UnitSystem.cs +++ b/UnitsNet/CustomCode/UnitSystem.cs @@ -78,6 +78,7 @@ static UnitSystem() /// public UnitSystem() : this(DefaultCulture) { + } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods diff --git a/UnitsNet/GeneratedCode/Enums/SubstanceAmountUnit.g.cs b/UnitsNet/GeneratedCode/Enums/SubstanceAmountUnit.g.cs deleted file mode 100644 index 5758da8bd8..0000000000 --- a/UnitsNet/GeneratedCode/Enums/SubstanceAmountUnit.g.cs +++ /dev/null @@ -1,53 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/anjdreas/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\UnitClasses\MyUnit.extra.cs files to add code to generated unit classes. -// Add Extensions\MyUnitExtensions.cs to decorate unit classes with new behavior. -// Add UnitDefinitions\MyUnit.json and run GeneratUnits.bat to generate new units or unit classes. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2007 Andreas Gullberg Larsen (anjdreas@gmail.com). -// https://github.com/anjdreas/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Units -{ - public enum SubstanceAmountUnit - { - Undefined = 0, - Centimole, - Decimole, - Kilomole, - Micromole, - Millimole, - Mole, - Nanomole, - } -} diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSubstanceAmountExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSubstanceAmountExtensions.g.cs deleted file mode 100644 index f80bbc5d7d..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSubstanceAmountExtensions.g.cs +++ /dev/null @@ -1,287 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/anjdreas/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\UnitClasses\MyUnit.extra.cs files to add code to generated unit classes. -// Add Extensions\MyUnitExtensions.cs to decorate unit classes with new behavior. -// Add UnitDefinitions\MyUnit.json and run GeneratUnits.bat to generate new units or unit classes. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2007 Andreas Gullberg Larsen (anjdreas@gmail.com). -// https://github.com/anjdreas/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToSubstanceAmount -{ - public static class NumberToSubstanceAmountExtensions - { - #region Centimole - - /// - public static SubstanceAmount Centimoles(this int value) => SubstanceAmount.FromCentimoles(value); - - /// - public static SubstanceAmount? Centimoles(this int? value) => SubstanceAmount.FromCentimoles(value); - - /// - public static SubstanceAmount Centimoles(this long value) => SubstanceAmount.FromCentimoles(value); - - /// - public static SubstanceAmount? Centimoles(this long? value) => SubstanceAmount.FromCentimoles(value); - - /// - public static SubstanceAmount Centimoles(this double value) => SubstanceAmount.FromCentimoles(value); - - /// - public static SubstanceAmount? Centimoles(this double? value) => SubstanceAmount.FromCentimoles(value); - - /// - public static SubstanceAmount Centimoles(this float value) => SubstanceAmount.FromCentimoles(value); - - /// - public static SubstanceAmount? Centimoles(this float? value) => SubstanceAmount.FromCentimoles(value); - - /// - public static SubstanceAmount Centimoles(this decimal value) => SubstanceAmount.FromCentimoles(Convert.ToDouble(value)); - - /// - public static SubstanceAmount? Centimoles(this decimal? value) => SubstanceAmount.FromCentimoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Decimole - - /// - public static SubstanceAmount Decimoles(this int value) => SubstanceAmount.FromDecimoles(value); - - /// - public static SubstanceAmount? Decimoles(this int? value) => SubstanceAmount.FromDecimoles(value); - - /// - public static SubstanceAmount Decimoles(this long value) => SubstanceAmount.FromDecimoles(value); - - /// - public static SubstanceAmount? Decimoles(this long? value) => SubstanceAmount.FromDecimoles(value); - - /// - public static SubstanceAmount Decimoles(this double value) => SubstanceAmount.FromDecimoles(value); - - /// - public static SubstanceAmount? Decimoles(this double? value) => SubstanceAmount.FromDecimoles(value); - - /// - public static SubstanceAmount Decimoles(this float value) => SubstanceAmount.FromDecimoles(value); - - /// - public static SubstanceAmount? Decimoles(this float? value) => SubstanceAmount.FromDecimoles(value); - - /// - public static SubstanceAmount Decimoles(this decimal value) => SubstanceAmount.FromDecimoles(Convert.ToDouble(value)); - - /// - public static SubstanceAmount? Decimoles(this decimal? value) => SubstanceAmount.FromDecimoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilomole - - /// - public static SubstanceAmount Kilomoles(this int value) => SubstanceAmount.FromKilomoles(value); - - /// - public static SubstanceAmount? Kilomoles(this int? value) => SubstanceAmount.FromKilomoles(value); - - /// - public static SubstanceAmount Kilomoles(this long value) => SubstanceAmount.FromKilomoles(value); - - /// - public static SubstanceAmount? Kilomoles(this long? value) => SubstanceAmount.FromKilomoles(value); - - /// - public static SubstanceAmount Kilomoles(this double value) => SubstanceAmount.FromKilomoles(value); - - /// - public static SubstanceAmount? Kilomoles(this double? value) => SubstanceAmount.FromKilomoles(value); - - /// - public static SubstanceAmount Kilomoles(this float value) => SubstanceAmount.FromKilomoles(value); - - /// - public static SubstanceAmount? Kilomoles(this float? value) => SubstanceAmount.FromKilomoles(value); - - /// - public static SubstanceAmount Kilomoles(this decimal value) => SubstanceAmount.FromKilomoles(Convert.ToDouble(value)); - - /// - public static SubstanceAmount? Kilomoles(this decimal? value) => SubstanceAmount.FromKilomoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Micromole - - /// - public static SubstanceAmount Micromoles(this int value) => SubstanceAmount.FromMicromoles(value); - - /// - public static SubstanceAmount? Micromoles(this int? value) => SubstanceAmount.FromMicromoles(value); - - /// - public static SubstanceAmount Micromoles(this long value) => SubstanceAmount.FromMicromoles(value); - - /// - public static SubstanceAmount? Micromoles(this long? value) => SubstanceAmount.FromMicromoles(value); - - /// - public static SubstanceAmount Micromoles(this double value) => SubstanceAmount.FromMicromoles(value); - - /// - public static SubstanceAmount? Micromoles(this double? value) => SubstanceAmount.FromMicromoles(value); - - /// - public static SubstanceAmount Micromoles(this float value) => SubstanceAmount.FromMicromoles(value); - - /// - public static SubstanceAmount? Micromoles(this float? value) => SubstanceAmount.FromMicromoles(value); - - /// - public static SubstanceAmount Micromoles(this decimal value) => SubstanceAmount.FromMicromoles(Convert.ToDouble(value)); - - /// - public static SubstanceAmount? Micromoles(this decimal? value) => SubstanceAmount.FromMicromoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Millimole - - /// - public static SubstanceAmount Millimoles(this int value) => SubstanceAmount.FromMillimoles(value); - - /// - public static SubstanceAmount? Millimoles(this int? value) => SubstanceAmount.FromMillimoles(value); - - /// - public static SubstanceAmount Millimoles(this long value) => SubstanceAmount.FromMillimoles(value); - - /// - public static SubstanceAmount? Millimoles(this long? value) => SubstanceAmount.FromMillimoles(value); - - /// - public static SubstanceAmount Millimoles(this double value) => SubstanceAmount.FromMillimoles(value); - - /// - public static SubstanceAmount? Millimoles(this double? value) => SubstanceAmount.FromMillimoles(value); - - /// - public static SubstanceAmount Millimoles(this float value) => SubstanceAmount.FromMillimoles(value); - - /// - public static SubstanceAmount? Millimoles(this float? value) => SubstanceAmount.FromMillimoles(value); - - /// - public static SubstanceAmount Millimoles(this decimal value) => SubstanceAmount.FromMillimoles(Convert.ToDouble(value)); - - /// - public static SubstanceAmount? Millimoles(this decimal? value) => SubstanceAmount.FromMillimoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Mole - - /// - public static SubstanceAmount Moles(this int value) => SubstanceAmount.FromMoles(value); - - /// - public static SubstanceAmount? Moles(this int? value) => SubstanceAmount.FromMoles(value); - - /// - public static SubstanceAmount Moles(this long value) => SubstanceAmount.FromMoles(value); - - /// - public static SubstanceAmount? Moles(this long? value) => SubstanceAmount.FromMoles(value); - - /// - public static SubstanceAmount Moles(this double value) => SubstanceAmount.FromMoles(value); - - /// - public static SubstanceAmount? Moles(this double? value) => SubstanceAmount.FromMoles(value); - - /// - public static SubstanceAmount Moles(this float value) => SubstanceAmount.FromMoles(value); - - /// - public static SubstanceAmount? Moles(this float? value) => SubstanceAmount.FromMoles(value); - - /// - public static SubstanceAmount Moles(this decimal value) => SubstanceAmount.FromMoles(Convert.ToDouble(value)); - - /// - public static SubstanceAmount? Moles(this decimal? value) => SubstanceAmount.FromMoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Nanomole - - /// - public static SubstanceAmount Nanomoles(this int value) => SubstanceAmount.FromNanomoles(value); - - /// - public static SubstanceAmount? Nanomoles(this int? value) => SubstanceAmount.FromNanomoles(value); - - /// - public static SubstanceAmount Nanomoles(this long value) => SubstanceAmount.FromNanomoles(value); - - /// - public static SubstanceAmount? Nanomoles(this long? value) => SubstanceAmount.FromNanomoles(value); - - /// - public static SubstanceAmount Nanomoles(this double value) => SubstanceAmount.FromNanomoles(value); - - /// - public static SubstanceAmount? Nanomoles(this double? value) => SubstanceAmount.FromNanomoles(value); - - /// - public static SubstanceAmount Nanomoles(this float value) => SubstanceAmount.FromNanomoles(value); - - /// - public static SubstanceAmount? Nanomoles(this float? value) => SubstanceAmount.FromNanomoles(value); - - /// - public static SubstanceAmount Nanomoles(this decimal value) => SubstanceAmount.FromNanomoles(Convert.ToDouble(value)); - - /// - public static SubstanceAmount? Nanomoles(this decimal? value) => SubstanceAmount.FromNanomoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/UnitClasses/SubstanceAmount.g.cs b/UnitsNet/GeneratedCode/UnitClasses/SubstanceAmount.g.cs deleted file mode 100644 index 1d869f226b..0000000000 --- a/UnitsNet/GeneratedCode/UnitClasses/SubstanceAmount.g.cs +++ /dev/null @@ -1,867 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/anjdreas/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\UnitClasses\MyUnit.extra.cs files to add code to generated unit classes. -// Add Extensions\MyUnitExtensions.cs to decorate unit classes with new behavior. -// Add UnitDefinitions\MyUnit.json and run GeneratUnits.bat to generate new units or unit classes. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2007 Andreas Gullberg Larsen (anjdreas@gmail.com). -// https://github.com/anjdreas/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.Units; - -// Windows Runtime Component does not support CultureInfo type, so use culture name string instead for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if WINDOWS_UWP -using Culture = System.String; -#else -using Culture = System.IFormatProvider; -#endif - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Mole is the amount of substance containing Avagadro's Number (6.02 x 10 ^ 23) of real particles such as molecules,atoms, ions or radicals. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class SubstanceAmount -#else - public partial struct SubstanceAmount : IComparable, IComparable -#endif - { - /// - /// Base unit of SubstanceAmount. - /// - private readonly double _moles; - - // Windows Runtime Component requires a default constructor -#if WINDOWS_UWP - public SubstanceAmount() : this(0) - { - } -#endif - - public SubstanceAmount(double moles) - { - _moles = Convert.ToDouble(moles); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - private -#else - public -#endif - SubstanceAmount(long moles) - { - _moles = Convert.ToDouble(moles); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type -#if WINDOWS_UWP - private -#else - public -#endif - SubstanceAmount(decimal moles) - { - _moles = Convert.ToDouble(moles); - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.AmountOfSubstance; - - /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. - /// - public static SubstanceAmountUnit BaseUnit - { - get { return SubstanceAmountUnit.Mole; } - } - - /// - /// All units of measurement for the SubstanceAmount quantity. - /// - public static SubstanceAmountUnit[] Units { get; } = Enum.GetValues(typeof(SubstanceAmountUnit)).Cast().ToArray(); - - /// - /// Get SubstanceAmount in Centimoles. - /// - public double Centimoles - { - get { return (_moles) / 1e-2d; } - } - - /// - /// Get SubstanceAmount in Decimoles. - /// - public double Decimoles - { - get { return (_moles) / 1e-1d; } - } - - /// - /// Get SubstanceAmount in Kilomoles. - /// - public double Kilomoles - { - get { return (_moles) / 1e3d; } - } - - /// - /// Get SubstanceAmount in Micromoles. - /// - public double Micromoles - { - get { return (_moles) / 1e-6d; } - } - - /// - /// Get SubstanceAmount in Millimoles. - /// - public double Millimoles - { - get { return (_moles) / 1e-3d; } - } - - /// - /// Get SubstanceAmount in Moles. - /// - public double Moles - { - get { return _moles; } - } - - /// - /// Get SubstanceAmount in Nanomoles. - /// - public double Nanomoles - { - get { return (_moles) / 1e-9d; } - } - - #endregion - - #region Static - - public static SubstanceAmount Zero - { - get { return new SubstanceAmount(); } - } - - /// - /// Get SubstanceAmount from Centimoles. - /// - public static SubstanceAmount FromCentimoles(double centimoles) - { - return new SubstanceAmount((centimoles) * 1e-2d); - } - - /// - /// Get SubstanceAmount from Decimoles. - /// - public static SubstanceAmount FromDecimoles(double decimoles) - { - return new SubstanceAmount((decimoles) * 1e-1d); - } - - /// - /// Get SubstanceAmount from Kilomoles. - /// - public static SubstanceAmount FromKilomoles(double kilomoles) - { - return new SubstanceAmount((kilomoles) * 1e3d); - } - - /// - /// Get SubstanceAmount from Micromoles. - /// - public static SubstanceAmount FromMicromoles(double micromoles) - { - return new SubstanceAmount((micromoles) * 1e-6d); - } - - /// - /// Get SubstanceAmount from Millimoles. - /// - public static SubstanceAmount FromMillimoles(double millimoles) - { - return new SubstanceAmount((millimoles) * 1e-3d); - } - - /// - /// Get SubstanceAmount from Moles. - /// - public static SubstanceAmount FromMoles(double moles) - { - return new SubstanceAmount(moles); - } - - /// - /// Get SubstanceAmount from Nanomoles. - /// - public static SubstanceAmount FromNanomoles(double nanomoles) - { - return new SubstanceAmount((nanomoles) * 1e-9d); - } - - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable SubstanceAmount from nullable Centimoles. - /// - public static SubstanceAmount? FromCentimoles(double? centimoles) - { - if (centimoles.HasValue) - { - return FromCentimoles(centimoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SubstanceAmount from nullable Decimoles. - /// - public static SubstanceAmount? FromDecimoles(double? decimoles) - { - if (decimoles.HasValue) - { - return FromDecimoles(decimoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SubstanceAmount from nullable Kilomoles. - /// - public static SubstanceAmount? FromKilomoles(double? kilomoles) - { - if (kilomoles.HasValue) - { - return FromKilomoles(kilomoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SubstanceAmount from nullable Micromoles. - /// - public static SubstanceAmount? FromMicromoles(double? micromoles) - { - if (micromoles.HasValue) - { - return FromMicromoles(micromoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SubstanceAmount from nullable Millimoles. - /// - public static SubstanceAmount? FromMillimoles(double? millimoles) - { - if (millimoles.HasValue) - { - return FromMillimoles(millimoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SubstanceAmount from nullable Moles. - /// - public static SubstanceAmount? FromMoles(double? moles) - { - if (moles.HasValue) - { - return FromMoles(moles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SubstanceAmount from nullable Nanomoles. - /// - public static SubstanceAmount? FromNanomoles(double? nanomoles) - { - if (nanomoles.HasValue) - { - return FromNanomoles(nanomoles.Value); - } - else - { - return null; - } - } - -#endif - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// SubstanceAmount unit value. - public static SubstanceAmount From(double val, SubstanceAmountUnit fromUnit) - { - switch (fromUnit) - { - case SubstanceAmountUnit.Centimole: - return FromCentimoles(val); - case SubstanceAmountUnit.Decimole: - return FromDecimoles(val); - case SubstanceAmountUnit.Kilomole: - return FromKilomoles(val); - case SubstanceAmountUnit.Micromole: - return FromMicromoles(val); - case SubstanceAmountUnit.Millimole: - return FromMillimoles(val); - case SubstanceAmountUnit.Mole: - return FromMoles(val); - case SubstanceAmountUnit.Nanomole: - return FromNanomoles(val); - - default: - throw new NotImplementedException("fromUnit: " + fromUnit); - } - } - - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// SubstanceAmount unit value. - public static SubstanceAmount? From(double? value, SubstanceAmountUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - switch (fromUnit) - { - case SubstanceAmountUnit.Centimole: - return FromCentimoles(value.Value); - case SubstanceAmountUnit.Decimole: - return FromDecimoles(value.Value); - case SubstanceAmountUnit.Kilomole: - return FromKilomoles(value.Value); - case SubstanceAmountUnit.Micromole: - return FromMicromoles(value.Value); - case SubstanceAmountUnit.Millimole: - return FromMillimoles(value.Value); - case SubstanceAmountUnit.Mole: - return FromMoles(value.Value); - case SubstanceAmountUnit.Nanomole: - return FromNanomoles(value.Value); - - default: - throw new NotImplementedException("fromUnit: " + fromUnit); - } - } -#endif - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SubstanceAmountUnit unit) - { - return GetAbbreviation(unit, null); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Culture to use for localization. Defaults to Thread.CurrentUICulture. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SubstanceAmountUnit unit, [CanBeNull] Culture culture) - { - return UnitSystem.GetCached(culture).GetDefaultAbbreviation(unit); - } - - #endregion - - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static SubstanceAmount operator -(SubstanceAmount right) - { - return new SubstanceAmount(-right._moles); - } - - public static SubstanceAmount operator +(SubstanceAmount left, SubstanceAmount right) - { - return new SubstanceAmount(left._moles + right._moles); - } - - public static SubstanceAmount operator -(SubstanceAmount left, SubstanceAmount right) - { - return new SubstanceAmount(left._moles - right._moles); - } - - public static SubstanceAmount operator *(double left, SubstanceAmount right) - { - return new SubstanceAmount(left*right._moles); - } - - public static SubstanceAmount operator *(SubstanceAmount left, double right) - { - return new SubstanceAmount(left._moles*(double)right); - } - - public static SubstanceAmount operator /(SubstanceAmount left, double right) - { - return new SubstanceAmount(left._moles/(double)right); - } - - public static double operator /(SubstanceAmount left, SubstanceAmount right) - { - return Convert.ToDouble(left._moles/right._moles); - } -#endif - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if (obj == null) throw new ArgumentNullException("obj"); - if (!(obj is SubstanceAmount)) throw new ArgumentException("Expected type SubstanceAmount.", "obj"); - return CompareTo((SubstanceAmount) obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(SubstanceAmount other) - { - return _moles.CompareTo(other._moles); - } - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(SubstanceAmount left, SubstanceAmount right) - { - return left._moles <= right._moles; - } - - public static bool operator >=(SubstanceAmount left, SubstanceAmount right) - { - return left._moles >= right._moles; - } - - public static bool operator <(SubstanceAmount left, SubstanceAmount right) - { - return left._moles < right._moles; - } - - public static bool operator >(SubstanceAmount left, SubstanceAmount right) - { - return left._moles > right._moles; - } - - public static bool operator ==(SubstanceAmount left, SubstanceAmount right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left._moles == right._moles; - } - - public static bool operator !=(SubstanceAmount left, SubstanceAmount right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left._moles != right._moles; - } -#endif - - public override bool Equals(object obj) - { - if (obj == null || GetType() != obj.GetType()) - { - return false; - } - - return _moles.Equals(((SubstanceAmount) obj)._moles); - } - - public override int GetHashCode() - { - return _moles.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value in new unit if successful, exception otherwise. - /// If conversion was not successful. - public double As(SubstanceAmountUnit unit) - { - switch (unit) - { - case SubstanceAmountUnit.Centimole: - return Centimoles; - case SubstanceAmountUnit.Decimole: - return Decimoles; - case SubstanceAmountUnit.Kilomole: - return Kilomoles; - case SubstanceAmountUnit.Micromole: - return Micromoles; - case SubstanceAmountUnit.Millimole: - return Millimoles; - case SubstanceAmountUnit.Mole: - return Moles; - case SubstanceAmountUnit.Nanomole: - return Nanomoles; - - default: - throw new NotImplementedException("unit: " + unit); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SubstanceAmount Parse(string str) - { - return Parse(str, null); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. If it is null, it defaults to for parsing the number and for parsing the unit abbreviation by culture/language. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SubstanceAmount Parse(string str, [CanBeNull] Culture culture) - { - if (str == null) throw new ArgumentNullException("str"); - - // Windows Runtime Component does not support CultureInfo type, so use culture name string for public methods instead: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if WINDOWS_UWP - IFormatProvider formatProvider = culture == null ? null : new CultureInfo(culture); -#else - IFormatProvider formatProvider = culture; -#endif - return QuantityParser.Parse(str, formatProvider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - SubstanceAmountUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromMoles(x.Moles + y.Moles)); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out SubstanceAmount result) - { - return TryParse(str, null, out result); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. If it is null, it defaults to for parsing the number and for parsing the unit abbreviation by culture/language. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] Culture culture, out SubstanceAmount result) - { - try - { - result = Parse(str, culture); - return true; - } - catch - { - result = default(SubstanceAmount); - return false; - } - } - - /// - /// Parse a unit string. - /// - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SubstanceAmountUnit ParseUnit(string str) - { - return ParseUnit(str, (IFormatProvider)null); - } - - /// - /// Parse a unit string. - /// - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SubstanceAmountUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - - /// - /// Parse a unit string. - /// - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - static SubstanceAmountUnit ParseUnit(string str, IFormatProvider formatProvider = null) - { - if (str == null) throw new ArgumentNullException("str"); - - var unitSystem = UnitSystem.GetCached(formatProvider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == SubstanceAmountUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SubstanceAmountUnit."); - newEx.Data["input"] = str; - newEx.Data["formatprovider"] = formatProvider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - #endregion - - /// - /// Set the default unit used by ToString(). Default is Mole - /// - public static SubstanceAmountUnit ToStringDefaultUnit { get; set; } = SubstanceAmountUnit.Mole; - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(ToStringDefaultUnit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(SubstanceAmountUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Culture to use for localization and number formatting. - /// String representation. - public string ToString(SubstanceAmountUnit unit, [CanBeNull] Culture culture) - { - return ToString(unit, culture, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Culture to use for localization and number formatting. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(SubstanceAmountUnit unit, [CanBeNull] Culture culture, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, culture, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Culture to use for localization and number formatting. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(SubstanceAmountUnit unit, [CanBeNull] Culture culture, [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 type, so use culture name string for public methods instead: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if WINDOWS_UWP - IFormatProvider formatProvider = culture == null ? null : new CultureInfo(culture); -#else - IFormatProvider formatProvider = culture; -#endif - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, formatProvider, args); - return string.Format(formatProvider, format, formatArgs); - } - - /// - /// Represents the largest possible value of SubstanceAmount - /// - public static SubstanceAmount MaxValue - { - get - { - return new SubstanceAmount(double.MaxValue); - } - } - - /// - /// Represents the smallest possible value of SubstanceAmount - /// - public static SubstanceAmount MinValue - { - get - { - return new SubstanceAmount(double.MinValue); - } - } - } -} diff --git a/UnitsNet/UnitsNet.NetStandard10.csproj b/UnitsNet/UnitsNet.NetStandard10.csproj index bcefd551d2..74589ad82b 100644 --- a/UnitsNet/UnitsNet.NetStandard10.csproj +++ b/UnitsNet/UnitsNet.NetStandard10.csproj @@ -19,4 +19,7 @@ + + +