diff --git a/UnitsNet.Tests/CustomCode/SolidAngleTests.cs b/UnitsNet.Tests/CustomCode/SolidAngleTests.cs
new file mode 100644
index 0000000000..268e16995a
--- /dev/null
+++ b/UnitsNet.Tests/CustomCode/SolidAngleTests.cs
@@ -0,0 +1,51 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated (once) by \generate-code.bat, but will not be
+// regenerated when it already exists. The purpose of creating this file is to make
+// it easier to remember to implement all the unit conversion test cases.
+//
+// Whenever a new unit is added to this quantity and \generate-code.bat is run,
+// the base test class will get a new abstract property and cause a compile error
+// in this derived class, reminding the developer to implement the test case
+// for the new unit.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyUnit.extra.cs files to add code to generated quantities.
+// Add Extensions\MyUnitExtensions.cs to decorate quantities with new behavior.
+// Add UnitDefinitions\MyUnit.json and run GeneratUnits.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
+// https://github.com/angularsen/UnitsNet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+
+using System;
+
+namespace UnitsNet.Tests.CustomCode
+{
+ public class SolidAngleTests : SolidAngleTestsBase
+ {
+ protected override double SteradiansInOneSteradian => 1;
+ }
+}
diff --git a/UnitsNet.Tests/CustomCode/ThermalConductivityTests.cs b/UnitsNet.Tests/CustomCode/ThermalConductivityTests.cs
new file mode 100644
index 0000000000..d9e89b41e2
--- /dev/null
+++ b/UnitsNet.Tests/CustomCode/ThermalConductivityTests.cs
@@ -0,0 +1,51 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated (once) by \generate-code.bat, but will not be
+// regenerated when it already exists. The purpose of creating this file is to make
+// it easier to remember to implement all the unit conversion test cases.
+//
+// Whenever a new unit is added to this quantity and \generate-code.bat is run,
+// the base test class will get a new abstract property and cause a compile error
+// in this derived class, reminding the developer to implement the test case
+// for the new unit.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyUnit.extra.cs files to add code to generated quantities.
+// Add Extensions\MyUnitExtensions.cs to decorate quantities with new behavior.
+// Add UnitDefinitions\MyUnit.json and run GeneratUnits.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
+// https://github.com/angularsen/UnitsNet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+
+using System;
+
+namespace UnitsNet.Tests.CustomCode
+{
+ public class ThermalConductivityTests : ThermalConductivityTestsBase
+ {
+ protected override double WattsPerMeterKelvinInOneWattPerMeterKelvin => 1;
+ }
+}
diff --git a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs
new file mode 100644
index 0000000000..896ef461e2
--- /dev/null
+++ b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs
@@ -0,0 +1,179 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on each local build.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyUnit.extra.cs files to add code to generated quantities.
+// Add Extensions\MyUnitExtensions.cs to decorate quantities with new behavior.
+// Add UnitDefinitions\MyUnit.json and run GeneratUnits.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
+// https://github.com/angularsen/UnitsNet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 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 SolidAngle.
+ ///
+// ReSharper disable once PartialTypeWithSinglePart
+ public abstract partial class SolidAngleTestsBase
+ {
+ protected abstract double SteradiansInOneSteradian { get; }
+
+// ReSharper disable VirtualMemberNeverOverriden.Global
+ protected virtual double SteradiansTolerance { get { return 1e-5; } }
+// ReSharper restore VirtualMemberNeverOverriden.Global
+
+ [Fact]
+ public void SteradianToSolidAngleUnits()
+ {
+ SolidAngle steradian = SolidAngle.FromSteradians(1);
+ AssertEx.EqualTolerance(SteradiansInOneSteradian, steradian.Steradians, SteradiansTolerance);
+ }
+
+ [Fact]
+ public void FromValueAndUnit()
+ {
+ AssertEx.EqualTolerance(1, SolidAngle.From(1, SolidAngleUnit.Steradian).Steradians, SteradiansTolerance);
+ }
+
+ [Fact]
+ public void As()
+ {
+ var steradian = SolidAngle.FromSteradians(1);
+ AssertEx.EqualTolerance(SteradiansInOneSteradian, steradian.As(SolidAngleUnit.Steradian), SteradiansTolerance);
+ }
+
+ [Fact]
+ public void ConversionRoundTrip()
+ {
+ SolidAngle steradian = SolidAngle.FromSteradians(1);
+ AssertEx.EqualTolerance(1, SolidAngle.FromSteradians(steradian.Steradians).Steradians, SteradiansTolerance);
+ }
+
+ [Fact]
+ public void ArithmeticOperators()
+ {
+ SolidAngle v = SolidAngle.FromSteradians(1);
+ AssertEx.EqualTolerance(-1, -v.Steradians, SteradiansTolerance);
+ AssertEx.EqualTolerance(2, (SolidAngle.FromSteradians(3)-v).Steradians, SteradiansTolerance);
+ AssertEx.EqualTolerance(2, (v + v).Steradians, SteradiansTolerance);
+ AssertEx.EqualTolerance(10, (v*10).Steradians, SteradiansTolerance);
+ AssertEx.EqualTolerance(10, (10*v).Steradians, SteradiansTolerance);
+ AssertEx.EqualTolerance(2, (SolidAngle.FromSteradians(10)/5).Steradians, SteradiansTolerance);
+ AssertEx.EqualTolerance(2, SolidAngle.FromSteradians(10)/SolidAngle.FromSteradians(5), SteradiansTolerance);
+ }
+
+ [Fact]
+ public void ComparisonOperators()
+ {
+ SolidAngle oneSteradian = SolidAngle.FromSteradians(1);
+ SolidAngle twoSteradians = SolidAngle.FromSteradians(2);
+
+ Assert.True(oneSteradian < twoSteradians);
+ Assert.True(oneSteradian <= twoSteradians);
+ Assert.True(twoSteradians > oneSteradian);
+ Assert.True(twoSteradians >= oneSteradian);
+
+ Assert.False(oneSteradian > twoSteradians);
+ Assert.False(oneSteradian >= twoSteradians);
+ Assert.False(twoSteradians < oneSteradian);
+ Assert.False(twoSteradians <= oneSteradian);
+ }
+
+ [Fact]
+ public void CompareToIsImplemented()
+ {
+ SolidAngle steradian = SolidAngle.FromSteradians(1);
+ Assert.Equal(0, steradian.CompareTo(steradian));
+ Assert.True(steradian.CompareTo(SolidAngle.Zero) > 0);
+ Assert.True(SolidAngle.Zero.CompareTo(steradian) < 0);
+ }
+
+ [Fact]
+ public void CompareToThrowsOnTypeMismatch()
+ {
+ SolidAngle steradian = SolidAngle.FromSteradians(1);
+ Assert.Throws(() => steradian.CompareTo(new object()));
+ }
+
+ [Fact]
+ public void CompareToThrowsOnNull()
+ {
+ SolidAngle steradian = SolidAngle.FromSteradians(1);
+ Assert.Throws(() => steradian.CompareTo(null));
+ }
+
+
+ [Fact]
+ public void EqualityOperators()
+ {
+ SolidAngle a = SolidAngle.FromSteradians(1);
+ SolidAngle b = SolidAngle.FromSteradians(2);
+
+// ReSharper disable EqualExpressionComparison
+ Assert.True(a == a);
+ Assert.True(a != b);
+
+ Assert.False(a == b);
+ Assert.False(a != a);
+// ReSharper restore EqualExpressionComparison
+ }
+
+ [Fact]
+ public void EqualsIsImplemented()
+ {
+ SolidAngle v = SolidAngle.FromSteradians(1);
+ Assert.True(v.Equals(SolidAngle.FromSteradians(1), SolidAngle.FromSteradians(SteradiansTolerance)));
+ Assert.False(v.Equals(SolidAngle.Zero, SolidAngle.FromSteradians(SteradiansTolerance)));
+ }
+
+ [Fact]
+ public void EqualsReturnsFalseOnTypeMismatch()
+ {
+ SolidAngle steradian = SolidAngle.FromSteradians(1);
+ Assert.False(steradian.Equals(new object()));
+ }
+
+ [Fact]
+ public void EqualsReturnsFalseOnNull()
+ {
+ SolidAngle steradian = SolidAngle.FromSteradians(1);
+ Assert.False(steradian.Equals(null));
+ }
+ }
+}
diff --git a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs
new file mode 100644
index 0000000000..2509e17b3a
--- /dev/null
+++ b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs
@@ -0,0 +1,179 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on each local build.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyUnit.extra.cs files to add code to generated quantities.
+// Add Extensions\MyUnitExtensions.cs to decorate quantities with new behavior.
+// Add UnitDefinitions\MyUnit.json and run GeneratUnits.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
+// https://github.com/angularsen/UnitsNet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 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 ThermalConductivity.
+ ///
+// ReSharper disable once PartialTypeWithSinglePart
+ public abstract partial class ThermalConductivityTestsBase
+ {
+ protected abstract double WattsPerMeterKelvinInOneWattPerMeterKelvin { get; }
+
+// ReSharper disable VirtualMemberNeverOverriden.Global
+ protected virtual double WattsPerMeterKelvinTolerance { get { return 1e-5; } }
+// ReSharper restore VirtualMemberNeverOverriden.Global
+
+ [Fact]
+ public void WattPerMeterKelvinToThermalConductivityUnits()
+ {
+ ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1);
+ AssertEx.EqualTolerance(WattsPerMeterKelvinInOneWattPerMeterKelvin, wattpermeterkelvin.WattsPerMeterKelvin, WattsPerMeterKelvinTolerance);
+ }
+
+ [Fact]
+ public void FromValueAndUnit()
+ {
+ AssertEx.EqualTolerance(1, ThermalConductivity.From(1, ThermalConductivityUnit.WattPerMeterKelvin).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance);
+ }
+
+ [Fact]
+ public void As()
+ {
+ var wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1);
+ AssertEx.EqualTolerance(WattsPerMeterKelvinInOneWattPerMeterKelvin, wattpermeterkelvin.As(ThermalConductivityUnit.WattPerMeterKelvin), WattsPerMeterKelvinTolerance);
+ }
+
+ [Fact]
+ public void ConversionRoundTrip()
+ {
+ ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1);
+ AssertEx.EqualTolerance(1, ThermalConductivity.FromWattsPerMeterKelvin(wattpermeterkelvin.WattsPerMeterKelvin).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance);
+ }
+
+ [Fact]
+ public void ArithmeticOperators()
+ {
+ ThermalConductivity v = ThermalConductivity.FromWattsPerMeterKelvin(1);
+ AssertEx.EqualTolerance(-1, -v.WattsPerMeterKelvin, WattsPerMeterKelvinTolerance);
+ AssertEx.EqualTolerance(2, (ThermalConductivity.FromWattsPerMeterKelvin(3)-v).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance);
+ AssertEx.EqualTolerance(2, (v + v).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance);
+ AssertEx.EqualTolerance(10, (v*10).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance);
+ AssertEx.EqualTolerance(10, (10*v).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance);
+ AssertEx.EqualTolerance(2, (ThermalConductivity.FromWattsPerMeterKelvin(10)/5).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance);
+ AssertEx.EqualTolerance(2, ThermalConductivity.FromWattsPerMeterKelvin(10)/ThermalConductivity.FromWattsPerMeterKelvin(5), WattsPerMeterKelvinTolerance);
+ }
+
+ [Fact]
+ public void ComparisonOperators()
+ {
+ ThermalConductivity oneWattPerMeterKelvin = ThermalConductivity.FromWattsPerMeterKelvin(1);
+ ThermalConductivity twoWattsPerMeterKelvin = ThermalConductivity.FromWattsPerMeterKelvin(2);
+
+ Assert.True(oneWattPerMeterKelvin < twoWattsPerMeterKelvin);
+ Assert.True(oneWattPerMeterKelvin <= twoWattsPerMeterKelvin);
+ Assert.True(twoWattsPerMeterKelvin > oneWattPerMeterKelvin);
+ Assert.True(twoWattsPerMeterKelvin >= oneWattPerMeterKelvin);
+
+ Assert.False(oneWattPerMeterKelvin > twoWattsPerMeterKelvin);
+ Assert.False(oneWattPerMeterKelvin >= twoWattsPerMeterKelvin);
+ Assert.False(twoWattsPerMeterKelvin < oneWattPerMeterKelvin);
+ Assert.False(twoWattsPerMeterKelvin <= oneWattPerMeterKelvin);
+ }
+
+ [Fact]
+ public void CompareToIsImplemented()
+ {
+ ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1);
+ Assert.Equal(0, wattpermeterkelvin.CompareTo(wattpermeterkelvin));
+ Assert.True(wattpermeterkelvin.CompareTo(ThermalConductivity.Zero) > 0);
+ Assert.True(ThermalConductivity.Zero.CompareTo(wattpermeterkelvin) < 0);
+ }
+
+ [Fact]
+ public void CompareToThrowsOnTypeMismatch()
+ {
+ ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1);
+ Assert.Throws(() => wattpermeterkelvin.CompareTo(new object()));
+ }
+
+ [Fact]
+ public void CompareToThrowsOnNull()
+ {
+ ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1);
+ Assert.Throws(() => wattpermeterkelvin.CompareTo(null));
+ }
+
+
+ [Fact]
+ public void EqualityOperators()
+ {
+ ThermalConductivity a = ThermalConductivity.FromWattsPerMeterKelvin(1);
+ ThermalConductivity b = ThermalConductivity.FromWattsPerMeterKelvin(2);
+
+// ReSharper disable EqualExpressionComparison
+ Assert.True(a == a);
+ Assert.True(a != b);
+
+ Assert.False(a == b);
+ Assert.False(a != a);
+// ReSharper restore EqualExpressionComparison
+ }
+
+ [Fact]
+ public void EqualsIsImplemented()
+ {
+ ThermalConductivity v = ThermalConductivity.FromWattsPerMeterKelvin(1);
+ Assert.True(v.Equals(ThermalConductivity.FromWattsPerMeterKelvin(1), ThermalConductivity.FromWattsPerMeterKelvin(WattsPerMeterKelvinTolerance)));
+ Assert.False(v.Equals(ThermalConductivity.Zero, ThermalConductivity.FromWattsPerMeterKelvin(WattsPerMeterKelvinTolerance)));
+ }
+
+ [Fact]
+ public void EqualsReturnsFalseOnTypeMismatch()
+ {
+ ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1);
+ Assert.False(wattpermeterkelvin.Equals(new object()));
+ }
+
+ [Fact]
+ public void EqualsReturnsFalseOnNull()
+ {
+ ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1);
+ Assert.False(wattpermeterkelvin.Equals(null));
+ }
+ }
+}
diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSolidAngleExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSolidAngleExtensions.g.cs
new file mode 100644
index 0000000000..27897f4a92
--- /dev/null
+++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSolidAngleExtensions.g.cs
@@ -0,0 +1,83 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on each local build.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyUnit.extra.cs files to add code to generated quantities.
+// Add Extensions\MyUnitExtensions.cs to decorate quantities with new behavior.
+// Add UnitDefinitions\MyUnit.json and run GeneratUnits.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
+// https://github.com/angularsen/UnitsNet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+
+// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
+#if !WINDOWS_UWP
+namespace UnitsNet.Extensions.NumberToSolidAngle
+{
+ public static class NumberToSolidAngleExtensions
+ {
+ #region Steradian
+
+ ///
+ public static SolidAngle Steradians(this int value) => SolidAngle.FromSteradians(value);
+
+ ///
+ public static SolidAngle? Steradians(this int? value) => SolidAngle.FromSteradians(value);
+
+ ///
+ public static SolidAngle Steradians(this long value) => SolidAngle.FromSteradians(value);
+
+ ///
+ public static SolidAngle? Steradians(this long? value) => SolidAngle.FromSteradians(value);
+
+ ///
+ public static SolidAngle Steradians(this double value) => SolidAngle.FromSteradians(value);
+
+ ///
+ public static SolidAngle? Steradians(this double? value) => SolidAngle.FromSteradians(value);
+
+ ///
+ public static SolidAngle Steradians(this float value) => SolidAngle.FromSteradians(value);
+
+ ///
+ public static SolidAngle? Steradians(this float? value) => SolidAngle.FromSteradians(value);
+
+ ///
+ public static SolidAngle Steradians(this decimal value) => SolidAngle.FromSteradians(Convert.ToDouble(value));
+
+ ///
+ public static SolidAngle? Steradians(this decimal? value) => SolidAngle.FromSteradians(value == null ? (double?)null : Convert.ToDouble(value.Value));
+
+ #endregion
+
+ }
+}
+#endif
diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalConductivityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalConductivityExtensions.g.cs
new file mode 100644
index 0000000000..3002ead61e
--- /dev/null
+++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalConductivityExtensions.g.cs
@@ -0,0 +1,83 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on each local build.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyUnit.extra.cs files to add code to generated quantities.
+// Add Extensions\MyUnitExtensions.cs to decorate quantities with new behavior.
+// Add UnitDefinitions\MyUnit.json and run GeneratUnits.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
+// https://github.com/angularsen/UnitsNet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+
+// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
+#if !WINDOWS_UWP
+namespace UnitsNet.Extensions.NumberToThermalConductivity
+{
+ public static class NumberToThermalConductivityExtensions
+ {
+ #region WattPerMeterKelvin
+
+ ///
+ public static ThermalConductivity WattsPerMeterKelvin(this int value) => ThermalConductivity.FromWattsPerMeterKelvin(value);
+
+ ///
+ public static ThermalConductivity? WattsPerMeterKelvin(this int? value) => ThermalConductivity.FromWattsPerMeterKelvin(value);
+
+ ///
+ public static ThermalConductivity WattsPerMeterKelvin(this long value) => ThermalConductivity.FromWattsPerMeterKelvin(value);
+
+ ///
+ public static ThermalConductivity? WattsPerMeterKelvin(this long? value) => ThermalConductivity.FromWattsPerMeterKelvin(value);
+
+ ///
+ public static ThermalConductivity WattsPerMeterKelvin(this double value) => ThermalConductivity.FromWattsPerMeterKelvin(value);
+
+ ///
+ public static ThermalConductivity? WattsPerMeterKelvin(this double? value) => ThermalConductivity.FromWattsPerMeterKelvin(value);
+
+ ///
+ public static ThermalConductivity WattsPerMeterKelvin(this float value) => ThermalConductivity.FromWattsPerMeterKelvin(value);
+
+ ///
+ public static ThermalConductivity? WattsPerMeterKelvin(this float? value) => ThermalConductivity.FromWattsPerMeterKelvin(value);
+
+ ///
+ public static ThermalConductivity WattsPerMeterKelvin(this decimal value) => ThermalConductivity.FromWattsPerMeterKelvin(Convert.ToDouble(value));
+
+ ///
+ public static ThermalConductivity? WattsPerMeterKelvin(this decimal? value) => ThermalConductivity.FromWattsPerMeterKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value));
+
+ #endregion
+
+ }
+}
+#endif
diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs
new file mode 100644
index 0000000000..3918442c69
--- /dev/null
+++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs
@@ -0,0 +1,677 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on each local build.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyUnit.extra.cs files to add code to generated quantities.
+// Add Extensions\MyUnitExtensions.cs to decorate quantities with new behavior.
+// Add UnitDefinitions\MyUnit.json and run GeneratUnits.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
+// https://github.com/angularsen/UnitsNet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 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
+{
+ ///
+ /// In geometry, a solid angle is the two-dimensional angle in three-dimensional space that an object subtends at a point.
+ ///
+ // ReSharper disable once PartialTypeWithSinglePart
+
+ // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components
+ // Public structures can't have any members other than public fields, and those fields must be value types or strings.
+ // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic.
+#if WINDOWS_UWP
+ public sealed partial class SolidAngle
+#else
+ public partial struct SolidAngle : IComparable, IComparable
+#endif
+ {
+ ///
+ /// Base unit of SolidAngle.
+ ///
+ private readonly double _steradians;
+
+ // Windows Runtime Component requires a default constructor
+#if WINDOWS_UWP
+ public SolidAngle() : this(0)
+ {
+ }
+#endif
+
+ public SolidAngle(double steradians)
+ {
+ _steradians = Convert.ToDouble(steradians);
+ }
+
+ // Windows 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
+ SolidAngle(long steradians)
+ {
+ _steradians = Convert.ToDouble(steradians);
+ }
+
+ // Windows 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
+ SolidAngle(decimal steradians)
+ {
+ _steradians = Convert.ToDouble(steradians);
+ }
+
+ #region Properties
+
+ ///
+ /// The of this quantity.
+ ///
+ public static QuantityType QuantityType => QuantityType.SolidAngle;
+
+ ///
+ /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value.
+ ///
+ public static SolidAngleUnit BaseUnit
+ {
+ get { return SolidAngleUnit.Steradian; }
+ }
+
+ ///
+ /// All units of measurement for the SolidAngle quantity.
+ ///
+ public static SolidAngleUnit[] Units { get; } = Enum.GetValues(typeof(SolidAngleUnit)).Cast().ToArray();
+
+ ///
+ /// Get SolidAngle in Steradians.
+ ///
+ public double Steradians
+ {
+ get { return _steradians; }
+ }
+
+ #endregion
+
+ #region Static
+
+ public static SolidAngle Zero
+ {
+ get { return new SolidAngle(); }
+ }
+
+ ///
+ /// Get SolidAngle from Steradians.
+ ///
+#if WINDOWS_UWP
+ [Windows.Foundation.Metadata.DefaultOverload]
+ public static SolidAngle FromSteradians(double steradians)
+ {
+ double value = (double) steradians;
+ return new SolidAngle(value);
+ }
+#else
+ public static SolidAngle FromSteradians(QuantityValue steradians)
+ {
+ double value = (double) steradians;
+ return new SolidAngle((value));
+ }
+#endif
+
+ // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx
+#if !WINDOWS_UWP
+ ///
+ /// Get nullable SolidAngle from nullable Steradians.
+ ///
+ public static SolidAngle? FromSteradians(QuantityValue? steradians)
+ {
+ if (steradians.HasValue)
+ {
+ return FromSteradians(steradians.Value);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+#endif
+
+ ///
+ /// Dynamically convert from value and unit enum to .
+ ///
+ /// Value to convert from.
+ /// Unit to convert from.
+ /// SolidAngle unit value.
+#if WINDOWS_UWP
+ // Fix name conflict with parameter "value"
+ [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")]
+ public static SolidAngle From(double value, SolidAngleUnit fromUnit)
+#else
+ public static SolidAngle From(QuantityValue value, SolidAngleUnit fromUnit)
+#endif
+ {
+ switch (fromUnit)
+ {
+ case SolidAngleUnit.Steradian:
+ return FromSteradians(value);
+
+ 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.
+ /// SolidAngle unit value.
+ public static SolidAngle? From(QuantityValue? value, SolidAngleUnit fromUnit)
+ {
+ if (!value.HasValue)
+ {
+ return null;
+ }
+ switch (fromUnit)
+ {
+ case SolidAngleUnit.Steradian:
+ return FromSteradians(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(SolidAngleUnit 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(SolidAngleUnit 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 SolidAngle operator -(SolidAngle right)
+ {
+ return new SolidAngle(-right._steradians);
+ }
+
+ public static SolidAngle operator +(SolidAngle left, SolidAngle right)
+ {
+ return new SolidAngle(left._steradians + right._steradians);
+ }
+
+ public static SolidAngle operator -(SolidAngle left, SolidAngle right)
+ {
+ return new SolidAngle(left._steradians - right._steradians);
+ }
+
+ public static SolidAngle operator *(double left, SolidAngle right)
+ {
+ return new SolidAngle(left*right._steradians);
+ }
+
+ public static SolidAngle operator *(SolidAngle left, double right)
+ {
+ return new SolidAngle(left._steradians*(double)right);
+ }
+
+ public static SolidAngle operator /(SolidAngle left, double right)
+ {
+ return new SolidAngle(left._steradians/(double)right);
+ }
+
+ public static double operator /(SolidAngle left, SolidAngle right)
+ {
+ return Convert.ToDouble(left._steradians/right._steradians);
+ }
+#endif
+
+ #endregion
+
+ #region Equality / IComparable
+
+ public int CompareTo(object obj)
+ {
+ if (obj == null) throw new ArgumentNullException("obj");
+ if (!(obj is SolidAngle)) throw new ArgumentException("Expected type SolidAngle.", "obj");
+ return CompareTo((SolidAngle) obj);
+ }
+
+ // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
+#if WINDOWS_UWP
+ internal
+#else
+ public
+#endif
+ int CompareTo(SolidAngle other)
+ {
+ return _steradians.CompareTo(other._steradians);
+ }
+
+ // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
+#if !WINDOWS_UWP
+ public static bool operator <=(SolidAngle left, SolidAngle right)
+ {
+ return left._steradians <= right._steradians;
+ }
+
+ public static bool operator >=(SolidAngle left, SolidAngle right)
+ {
+ return left._steradians >= right._steradians;
+ }
+
+ public static bool operator <(SolidAngle left, SolidAngle right)
+ {
+ return left._steradians < right._steradians;
+ }
+
+ public static bool operator >(SolidAngle left, SolidAngle right)
+ {
+ return left._steradians > right._steradians;
+ }
+
+ [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")]
+ public static bool operator ==(SolidAngle left, SolidAngle right)
+ {
+ // ReSharper disable once CompareOfFloatsByEqualityOperator
+ return left._steradians == right._steradians;
+ }
+
+ [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")]
+ public static bool operator !=(SolidAngle left, SolidAngle right)
+ {
+ // ReSharper disable once CompareOfFloatsByEqualityOperator
+ return left._steradians != right._steradians;
+ }
+#endif
+
+ [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")]
+ public override bool Equals(object obj)
+ {
+ if (obj == null || GetType() != obj.GetType())
+ {
+ return false;
+ }
+
+ return _steradians.Equals(((SolidAngle) obj)._steradians);
+ }
+
+ ///
+ /// Compare equality to another SolidAngle by specifying a max allowed difference.
+ /// Note that it is advised against specifying zero difference, due to the nature
+ /// of floating point operations and using System.Double internally.
+ ///
+ /// Other quantity to compare to.
+ /// Max error allowed.
+ /// True if the difference between the two values is not greater than the specified max.
+ public bool Equals(SolidAngle other, SolidAngle maxError)
+ {
+ return Math.Abs(_steradians - other._steradians) <= maxError._steradians;
+ }
+
+ public override int GetHashCode()
+ {
+ return _steradians.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(SolidAngleUnit unit)
+ {
+ switch (unit)
+ {
+ case SolidAngleUnit.Steradian:
+ return Steradians;
+
+ 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 SolidAngle Parse(string str)
+ {
+ return Parse(str, null);
+ }
+
+ ///
+ /// Parse a string with one or two quantities of the format "<quantity> <unit>".
+ ///
+ /// String to parse. Typically in the form: {number} {unit}
+ /// 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 SolidAngle 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);
+ SolidAngleUnit parsedUnit = ParseUnit(unit, formatProvider2);
+ return From(parsedValue, parsedUnit);
+ }, (x, y) => FromSteradians(x.Steradians + y.Steradians));
+ }
+
+ ///
+ /// Try to parse a string with one or two quantities of the format "<quantity> <unit>".
+ ///
+ /// String to parse. Typically in the form: {number} {unit}
+ /// Resulting unit quantity if successful.
+ ///
+ /// Length.Parse("5.5 m", new CultureInfo("en-US"));
+ ///
+ public static bool TryParse([CanBeNull] string str, out SolidAngle result)
+ {
+ return TryParse(str, null, out result);
+ }
+
+ ///
+ /// Try to parse a string with one or two quantities of the format "<quantity> <unit>".
+ ///
+ /// String to parse. Typically in the form: {number} {unit}
+ /// 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 SolidAngle result)
+ {
+ try
+ {
+ result = Parse(str, culture);
+ return true;
+ }
+ catch
+ {
+ result = default(SolidAngle);
+ 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 SolidAngleUnit 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 SolidAngleUnit 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 SolidAngleUnit 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 == SolidAngleUnit.Undefined)
+ {
+ var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SolidAngleUnit.");
+ newEx.Data["input"] = str;
+ newEx.Data["formatprovider"] = formatProvider?.ToString() ?? "(null)";
+ throw newEx;
+ }
+
+ return unit;
+ }
+
+ #endregion
+
+ ///
+ /// Set the default unit used by ToString(). Default is Steradian
+ ///
+ public static SolidAngleUnit ToStringDefaultUnit { get; set; } = SolidAngleUnit.Steradian;
+
+ ///
+ /// 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(SolidAngleUnit 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(SolidAngleUnit 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(SolidAngleUnit 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(SolidAngleUnit 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 SolidAngle
+ ///
+ public static SolidAngle MaxValue
+ {
+ get
+ {
+ return new SolidAngle(double.MaxValue);
+ }
+ }
+
+ ///
+ /// Represents the smallest possible value of SolidAngle
+ ///
+ public static SolidAngle MinValue
+ {
+ get
+ {
+ return new SolidAngle(double.MinValue);
+ }
+ }
+ }
+}
diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs
new file mode 100644
index 0000000000..4b6a5ea739
--- /dev/null
+++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs
@@ -0,0 +1,677 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on each local build.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyUnit.extra.cs files to add code to generated quantities.
+// Add Extensions\MyUnitExtensions.cs to decorate quantities with new behavior.
+// Add UnitDefinitions\MyUnit.json and run GeneratUnits.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
+// https://github.com/angularsen/UnitsNet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 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
+{
+ ///
+ /// Thermal conductivity is the property of a material to conduct heat.
+ ///
+ // ReSharper disable once PartialTypeWithSinglePart
+
+ // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components
+ // Public structures can't have any members other than public fields, and those fields must be value types or strings.
+ // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic.
+#if WINDOWS_UWP
+ public sealed partial class ThermalConductivity
+#else
+ public partial struct ThermalConductivity : IComparable, IComparable
+#endif
+ {
+ ///
+ /// Base unit of ThermalConductivity.
+ ///
+ private readonly double _wattsPerMeterKelvin;
+
+ // Windows Runtime Component requires a default constructor
+#if WINDOWS_UWP
+ public ThermalConductivity() : this(0)
+ {
+ }
+#endif
+
+ public ThermalConductivity(double wattspermeterkelvin)
+ {
+ _wattsPerMeterKelvin = Convert.ToDouble(wattspermeterkelvin);
+ }
+
+ // Windows 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
+ ThermalConductivity(long wattspermeterkelvin)
+ {
+ _wattsPerMeterKelvin = Convert.ToDouble(wattspermeterkelvin);
+ }
+
+ // Windows 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
+ ThermalConductivity(decimal wattspermeterkelvin)
+ {
+ _wattsPerMeterKelvin = Convert.ToDouble(wattspermeterkelvin);
+ }
+
+ #region Properties
+
+ ///
+ /// The of this quantity.
+ ///
+ public static QuantityType QuantityType => QuantityType.ThermalConductivity;
+
+ ///
+ /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value.
+ ///
+ public static ThermalConductivityUnit BaseUnit
+ {
+ get { return ThermalConductivityUnit.WattPerMeterKelvin; }
+ }
+
+ ///
+ /// All units of measurement for the ThermalConductivity quantity.
+ ///
+ public static ThermalConductivityUnit[] Units { get; } = Enum.GetValues(typeof(ThermalConductivityUnit)).Cast().ToArray();
+
+ ///
+ /// Get ThermalConductivity in WattsPerMeterKelvin.
+ ///
+ public double WattsPerMeterKelvin
+ {
+ get { return _wattsPerMeterKelvin; }
+ }
+
+ #endregion
+
+ #region Static
+
+ public static ThermalConductivity Zero
+ {
+ get { return new ThermalConductivity(); }
+ }
+
+ ///
+ /// Get ThermalConductivity from WattsPerMeterKelvin.
+ ///
+#if WINDOWS_UWP
+ [Windows.Foundation.Metadata.DefaultOverload]
+ public static ThermalConductivity FromWattsPerMeterKelvin(double wattspermeterkelvin)
+ {
+ double value = (double) wattspermeterkelvin;
+ return new ThermalConductivity(value);
+ }
+#else
+ public static ThermalConductivity FromWattsPerMeterKelvin(QuantityValue wattspermeterkelvin)
+ {
+ double value = (double) wattspermeterkelvin;
+ return new ThermalConductivity((value));
+ }
+#endif
+
+ // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx
+#if !WINDOWS_UWP
+ ///
+ /// Get nullable ThermalConductivity from nullable WattsPerMeterKelvin.
+ ///
+ public static ThermalConductivity? FromWattsPerMeterKelvin(QuantityValue? wattspermeterkelvin)
+ {
+ if (wattspermeterkelvin.HasValue)
+ {
+ return FromWattsPerMeterKelvin(wattspermeterkelvin.Value);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+#endif
+
+ ///
+ /// Dynamically convert from value and unit enum to .
+ ///
+ /// Value to convert from.
+ /// Unit to convert from.
+ /// ThermalConductivity unit value.
+#if WINDOWS_UWP
+ // Fix name conflict with parameter "value"
+ [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")]
+ public static ThermalConductivity From(double value, ThermalConductivityUnit fromUnit)
+#else
+ public static ThermalConductivity From(QuantityValue value, ThermalConductivityUnit fromUnit)
+#endif
+ {
+ switch (fromUnit)
+ {
+ case ThermalConductivityUnit.WattPerMeterKelvin:
+ return FromWattsPerMeterKelvin(value);
+
+ 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.
+ /// ThermalConductivity unit value.
+ public static ThermalConductivity? From(QuantityValue? value, ThermalConductivityUnit fromUnit)
+ {
+ if (!value.HasValue)
+ {
+ return null;
+ }
+ switch (fromUnit)
+ {
+ case ThermalConductivityUnit.WattPerMeterKelvin:
+ return FromWattsPerMeterKelvin(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(ThermalConductivityUnit 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(ThermalConductivityUnit 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 ThermalConductivity operator -(ThermalConductivity right)
+ {
+ return new ThermalConductivity(-right._wattsPerMeterKelvin);
+ }
+
+ public static ThermalConductivity operator +(ThermalConductivity left, ThermalConductivity right)
+ {
+ return new ThermalConductivity(left._wattsPerMeterKelvin + right._wattsPerMeterKelvin);
+ }
+
+ public static ThermalConductivity operator -(ThermalConductivity left, ThermalConductivity right)
+ {
+ return new ThermalConductivity(left._wattsPerMeterKelvin - right._wattsPerMeterKelvin);
+ }
+
+ public static ThermalConductivity operator *(double left, ThermalConductivity right)
+ {
+ return new ThermalConductivity(left*right._wattsPerMeterKelvin);
+ }
+
+ public static ThermalConductivity operator *(ThermalConductivity left, double right)
+ {
+ return new ThermalConductivity(left._wattsPerMeterKelvin*(double)right);
+ }
+
+ public static ThermalConductivity operator /(ThermalConductivity left, double right)
+ {
+ return new ThermalConductivity(left._wattsPerMeterKelvin/(double)right);
+ }
+
+ public static double operator /(ThermalConductivity left, ThermalConductivity right)
+ {
+ return Convert.ToDouble(left._wattsPerMeterKelvin/right._wattsPerMeterKelvin);
+ }
+#endif
+
+ #endregion
+
+ #region Equality / IComparable
+
+ public int CompareTo(object obj)
+ {
+ if (obj == null) throw new ArgumentNullException("obj");
+ if (!(obj is ThermalConductivity)) throw new ArgumentException("Expected type ThermalConductivity.", "obj");
+ return CompareTo((ThermalConductivity) obj);
+ }
+
+ // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
+#if WINDOWS_UWP
+ internal
+#else
+ public
+#endif
+ int CompareTo(ThermalConductivity other)
+ {
+ return _wattsPerMeterKelvin.CompareTo(other._wattsPerMeterKelvin);
+ }
+
+ // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
+#if !WINDOWS_UWP
+ public static bool operator <=(ThermalConductivity left, ThermalConductivity right)
+ {
+ return left._wattsPerMeterKelvin <= right._wattsPerMeterKelvin;
+ }
+
+ public static bool operator >=(ThermalConductivity left, ThermalConductivity right)
+ {
+ return left._wattsPerMeterKelvin >= right._wattsPerMeterKelvin;
+ }
+
+ public static bool operator <(ThermalConductivity left, ThermalConductivity right)
+ {
+ return left._wattsPerMeterKelvin < right._wattsPerMeterKelvin;
+ }
+
+ public static bool operator >(ThermalConductivity left, ThermalConductivity right)
+ {
+ return left._wattsPerMeterKelvin > right._wattsPerMeterKelvin;
+ }
+
+ [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")]
+ public static bool operator ==(ThermalConductivity left, ThermalConductivity right)
+ {
+ // ReSharper disable once CompareOfFloatsByEqualityOperator
+ return left._wattsPerMeterKelvin == right._wattsPerMeterKelvin;
+ }
+
+ [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")]
+ public static bool operator !=(ThermalConductivity left, ThermalConductivity right)
+ {
+ // ReSharper disable once CompareOfFloatsByEqualityOperator
+ return left._wattsPerMeterKelvin != right._wattsPerMeterKelvin;
+ }
+#endif
+
+ [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")]
+ public override bool Equals(object obj)
+ {
+ if (obj == null || GetType() != obj.GetType())
+ {
+ return false;
+ }
+
+ return _wattsPerMeterKelvin.Equals(((ThermalConductivity) obj)._wattsPerMeterKelvin);
+ }
+
+ ///
+ /// Compare equality to another ThermalConductivity by specifying a max allowed difference.
+ /// Note that it is advised against specifying zero difference, due to the nature
+ /// of floating point operations and using System.Double internally.
+ ///
+ /// Other quantity to compare to.
+ /// Max error allowed.
+ /// True if the difference between the two values is not greater than the specified max.
+ public bool Equals(ThermalConductivity other, ThermalConductivity maxError)
+ {
+ return Math.Abs(_wattsPerMeterKelvin - other._wattsPerMeterKelvin) <= maxError._wattsPerMeterKelvin;
+ }
+
+ public override int GetHashCode()
+ {
+ return _wattsPerMeterKelvin.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(ThermalConductivityUnit unit)
+ {
+ switch (unit)
+ {
+ case ThermalConductivityUnit.WattPerMeterKelvin:
+ return WattsPerMeterKelvin;
+
+ 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 ThermalConductivity Parse(string str)
+ {
+ return Parse(str, null);
+ }
+
+ ///
+ /// Parse a string with one or two quantities of the format "<quantity> <unit>".
+ ///
+ /// String to parse. Typically in the form: {number} {unit}
+ /// 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 ThermalConductivity 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);
+ ThermalConductivityUnit parsedUnit = ParseUnit(unit, formatProvider2);
+ return From(parsedValue, parsedUnit);
+ }, (x, y) => FromWattsPerMeterKelvin(x.WattsPerMeterKelvin + y.WattsPerMeterKelvin));
+ }
+
+ ///
+ /// Try to parse a string with one or two quantities of the format "<quantity> <unit>".
+ ///
+ /// String to parse. Typically in the form: {number} {unit}
+ /// Resulting unit quantity if successful.
+ ///
+ /// Length.Parse("5.5 m", new CultureInfo("en-US"));
+ ///
+ public static bool TryParse([CanBeNull] string str, out ThermalConductivity result)
+ {
+ return TryParse(str, null, out result);
+ }
+
+ ///
+ /// Try to parse a string with one or two quantities of the format "<quantity> <unit>".
+ ///
+ /// String to parse. Typically in the form: {number} {unit}
+ /// 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 ThermalConductivity result)
+ {
+ try
+ {
+ result = Parse(str, culture);
+ return true;
+ }
+ catch
+ {
+ result = default(ThermalConductivity);
+ 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 ThermalConductivityUnit 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 ThermalConductivityUnit 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 ThermalConductivityUnit 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 == ThermalConductivityUnit.Undefined)
+ {
+ var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ThermalConductivityUnit.");
+ newEx.Data["input"] = str;
+ newEx.Data["formatprovider"] = formatProvider?.ToString() ?? "(null)";
+ throw newEx;
+ }
+
+ return unit;
+ }
+
+ #endregion
+
+ ///
+ /// Set the default unit used by ToString(). Default is WattPerMeterKelvin
+ ///
+ public static ThermalConductivityUnit ToStringDefaultUnit { get; set; } = ThermalConductivityUnit.WattPerMeterKelvin;
+
+ ///
+ /// 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(ThermalConductivityUnit 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(ThermalConductivityUnit 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(ThermalConductivityUnit 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(ThermalConductivityUnit 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 ThermalConductivity
+ ///
+ public static ThermalConductivity MaxValue
+ {
+ get
+ {
+ return new ThermalConductivity(double.MaxValue);
+ }
+ }
+
+ ///
+ /// Represents the smallest possible value of ThermalConductivity
+ ///
+ public static ThermalConductivity MinValue
+ {
+ get
+ {
+ return new ThermalConductivity(double.MinValue);
+ }
+ }
+ }
+}
diff --git a/UnitsNet/GeneratedCode/QuantityType.g.cs b/UnitsNet/GeneratedCode/QuantityType.g.cs
index 06688fd25d..5f8bfe80e9 100644
--- a/UnitsNet/GeneratedCode/QuantityType.g.cs
+++ b/UnitsNet/GeneratedCode/QuantityType.g.cs
@@ -93,6 +93,7 @@ public enum QuantityType
ReactivePower,
RotationalAcceleration,
RotationalSpeed,
+ SolidAngle,
SpecificEnergy,
SpecificEntropy,
SpecificVolume,
@@ -101,6 +102,7 @@ public enum QuantityType
Temperature,
TemperatureChangeRate,
TemperatureDelta,
+ ThermalConductivity,
ThermalResistance,
Torque,
VitaminA,
diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs
index 1a0537c3df..baedb7345c 100644
--- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs
+++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs
@@ -2684,6 +2684,15 @@ private static readonly ReadOnlyCollection DefaultLocalization
new AbbreviationsForCulture("ru-RU", "об/с"),
}),
}),
+ new UnitLocalization(typeof (SolidAngleUnit),
+ new[]
+ {
+ new CulturesForEnumValue((int) SolidAngleUnit.Steradian,
+ new[]
+ {
+ new AbbreviationsForCulture("en-US", "sr"),
+ }),
+ }),
new UnitLocalization(typeof (SpecificEnergyUnit),
new[]
{
@@ -3211,6 +3220,15 @@ private static readonly ReadOnlyCollection DefaultLocalization
new AbbreviationsForCulture("en-US", "∆K"),
}),
}),
+ new UnitLocalization(typeof (ThermalConductivityUnit),
+ new[]
+ {
+ new CulturesForEnumValue((int) ThermalConductivityUnit.WattPerMeterKelvin,
+ new[]
+ {
+ new AbbreviationsForCulture("en-US", "W/m·K"),
+ }),
+ }),
new UnitLocalization(typeof (ThermalResistanceUnit),
new[]
{
diff --git a/UnitsNet/GeneratedCode/Units/SolidAngleUnit.g.cs b/UnitsNet/GeneratedCode/Units/SolidAngleUnit.g.cs
new file mode 100644
index 0000000000..157e35838f
--- /dev/null
+++ b/UnitsNet/GeneratedCode/Units/SolidAngleUnit.g.cs
@@ -0,0 +1,47 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on each local build.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyUnit.extra.cs files to add code to generated quantities.
+// Add Extensions\MyUnitExtensions.cs to decorate quantities with new behavior.
+// Add UnitDefinitions\MyUnit.json and run GeneratUnits.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
+// https://github.com/angularsen/UnitsNet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION 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 SolidAngleUnit
+ {
+ Undefined = 0,
+ Steradian,
+ }
+}
diff --git a/UnitsNet/GeneratedCode/Units/ThermalConductivityUnit.g.cs b/UnitsNet/GeneratedCode/Units/ThermalConductivityUnit.g.cs
new file mode 100644
index 0000000000..ff8f8f2f93
--- /dev/null
+++ b/UnitsNet/GeneratedCode/Units/ThermalConductivityUnit.g.cs
@@ -0,0 +1,47 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on each local build.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\MyUnit.extra.cs files to add code to generated quantities.
+// Add Extensions\MyUnitExtensions.cs to decorate quantities with new behavior.
+// Add UnitDefinitions\MyUnit.json and run GeneratUnits.bat to generate new units or quantities.
+//
+//
+//------------------------------------------------------------------------------
+
+// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
+// https://github.com/angularsen/UnitsNet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION 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 ThermalConductivityUnit
+ {
+ Undefined = 0,
+ WattPerMeterKelvin,
+ }
+}
diff --git a/UnitsNet/UnitDefinitions/SolidAngle.json b/UnitsNet/UnitDefinitions/SolidAngle.json
new file mode 100644
index 0000000000..10cced6eee
--- /dev/null
+++ b/UnitsNet/UnitDefinitions/SolidAngle.json
@@ -0,0 +1,20 @@
+{
+ "Name": "SolidAngle",
+ "BaseUnit": "Steradian",
+ "XmlDoc": "In geometry, a solid angle is the two-dimensional angle in three-dimensional space that an object subtends at a point.",
+ "XmlDocRemarks": "https://en.wikipedia.org/wiki/Solid_angle",
+ "Units": [
+ {
+ "SingularName": "Steradian",
+ "PluralName": "Steradians",
+ "FromUnitToBaseFunc": "x",
+ "FromBaseToUnitFunc": "x",
+ "Localization": [
+ {
+ "Culture": "en-US",
+ "Abbreviations": [ "sr" ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/UnitsNet/UnitDefinitions/ThermalConductivity.json b/UnitsNet/UnitDefinitions/ThermalConductivity.json
new file mode 100644
index 0000000000..0fca4cb5f7
--- /dev/null
+++ b/UnitsNet/UnitDefinitions/ThermalConductivity.json
@@ -0,0 +1,20 @@
+{
+ "Name": "ThermalConductivity",
+ "BaseUnit": "WattPerMeterKelvin",
+ "XmlDoc": "Thermal conductivity is the property of a material to conduct heat.",
+ "XmlDocRemarks": "https://en.wikipedia.org/wiki/Thermal_Conductivity",
+ "Units": [
+ {
+ "SingularName": "WattPerMeterKelvin",
+ "PluralName": "WattsPerMeterKelvin",
+ "FromUnitToBaseFunc": "x",
+ "FromBaseToUnitFunc": "x",
+ "Localization": [
+ {
+ "Culture": "en-US",
+ "Abbreviations": [ "W/m·K" ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file