diff --git a/UnitsNet.Tests/CustomCode/RotationalStiffnessPerLengthTests.cs b/UnitsNet.Tests/CustomCode/RotationalStiffnessPerLengthTests.cs
new file mode 100644
index 0000000000..a74e63fddb
--- /dev/null
+++ b/UnitsNet.Tests/CustomCode/RotationalStiffnessPerLengthTests.cs
@@ -0,0 +1,55 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated (once) by \generate-code.bat, but will not be
+// regenerated when it already exists. The purpose of creating this file is to make
+// it easier to remember to implement all the unit conversion test cases.
+//
+// Whenever a new unit is added to this quantity and \generate-code.bat is run,
+// the base test class will get a new abstract property and cause a compile error
+// in this derived class, reminding the developer to implement the test case
+// for the new unit.
+//
+// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
+//
+// Add CustomCode\Quantities\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 RotationalStiffnessPerLengthTests : RotationalStiffnessPerLengthTestsBase
+ {
+ // TODO Override properties in base class here
+
+ protected override double KilonewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter => 1E-3;
+ protected override double MeganewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter => 1E-6;
+ protected override double NewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter => 1;
+ }
+}
diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs
new file mode 100644
index 0000000000..d65961de70
--- /dev/null
+++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs
@@ -0,0 +1,191 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on 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 RotationalStiffnessPerLength.
+ ///
+// ReSharper disable once PartialTypeWithSinglePart
+ public abstract partial class RotationalStiffnessPerLengthTestsBase
+ {
+ protected abstract double KilonewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter { get; }
+ protected abstract double MeganewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter { get; }
+ protected abstract double NewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter { get; }
+
+// ReSharper disable VirtualMemberNeverOverriden.Global
+ protected virtual double KilonewtonMetersPerRadianPerMeterTolerance { get { return 1e-5; } }
+ protected virtual double MeganewtonMetersPerRadianPerMeterTolerance { get { return 1e-5; } }
+ protected virtual double NewtonMetersPerRadianPerMeterTolerance { get { return 1e-5; } }
+// ReSharper restore VirtualMemberNeverOverriden.Global
+
+ [Fact]
+ public void NewtonMeterPerRadianPerMeterToRotationalStiffnessPerLengthUnits()
+ {
+ RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1);
+ AssertEx.EqualTolerance(KilonewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, newtonmeterperradianpermeter.KilonewtonMetersPerRadianPerMeter, KilonewtonMetersPerRadianPerMeterTolerance);
+ AssertEx.EqualTolerance(MeganewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, newtonmeterperradianpermeter.MeganewtonMetersPerRadianPerMeter, MeganewtonMetersPerRadianPerMeterTolerance);
+ AssertEx.EqualTolerance(NewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, newtonmeterperradianpermeter.NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance);
+ }
+
+ [Fact]
+ public void FromValueAndUnit()
+ {
+ AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.From(1, RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter).KilonewtonMetersPerRadianPerMeter, KilonewtonMetersPerRadianPerMeterTolerance);
+ AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.From(1, RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter).MeganewtonMetersPerRadianPerMeter, MeganewtonMetersPerRadianPerMeterTolerance);
+ AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.From(1, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance);
+ }
+
+ [Fact]
+ public void As()
+ {
+ var newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1);
+ AssertEx.EqualTolerance(KilonewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, newtonmeterperradianpermeter.As(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter), KilonewtonMetersPerRadianPerMeterTolerance);
+ AssertEx.EqualTolerance(MeganewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, newtonmeterperradianpermeter.As(RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter), MeganewtonMetersPerRadianPerMeterTolerance);
+ AssertEx.EqualTolerance(NewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, newtonmeterperradianpermeter.As(RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter), NewtonMetersPerRadianPerMeterTolerance);
+ }
+
+ [Fact]
+ public void ConversionRoundTrip()
+ {
+ RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1);
+ AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(newtonmeterperradianpermeter.KilonewtonMetersPerRadianPerMeter).NewtonMetersPerRadianPerMeter, KilonewtonMetersPerRadianPerMeterTolerance);
+ AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(newtonmeterperradianpermeter.MeganewtonMetersPerRadianPerMeter).NewtonMetersPerRadianPerMeter, MeganewtonMetersPerRadianPerMeterTolerance);
+ AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(newtonmeterperradianpermeter.NewtonMetersPerRadianPerMeter).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance);
+ }
+
+ [Fact]
+ public void ArithmeticOperators()
+ {
+ RotationalStiffnessPerLength v = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1);
+ AssertEx.EqualTolerance(-1, -v.NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance);
+ AssertEx.EqualTolerance(2, (RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(3)-v).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance);
+ AssertEx.EqualTolerance(2, (v + v).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance);
+ AssertEx.EqualTolerance(10, (v*10).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance);
+ AssertEx.EqualTolerance(10, (10*v).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance);
+ AssertEx.EqualTolerance(2, (RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(10)/5).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance);
+ AssertEx.EqualTolerance(2, RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(10)/RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(5), NewtonMetersPerRadianPerMeterTolerance);
+ }
+
+ [Fact]
+ public void ComparisonOperators()
+ {
+ RotationalStiffnessPerLength oneNewtonMeterPerRadianPerMeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1);
+ RotationalStiffnessPerLength twoNewtonMetersPerRadianPerMeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(2);
+
+ Assert.True(oneNewtonMeterPerRadianPerMeter < twoNewtonMetersPerRadianPerMeter);
+ Assert.True(oneNewtonMeterPerRadianPerMeter <= twoNewtonMetersPerRadianPerMeter);
+ Assert.True(twoNewtonMetersPerRadianPerMeter > oneNewtonMeterPerRadianPerMeter);
+ Assert.True(twoNewtonMetersPerRadianPerMeter >= oneNewtonMeterPerRadianPerMeter);
+
+ Assert.False(oneNewtonMeterPerRadianPerMeter > twoNewtonMetersPerRadianPerMeter);
+ Assert.False(oneNewtonMeterPerRadianPerMeter >= twoNewtonMetersPerRadianPerMeter);
+ Assert.False(twoNewtonMetersPerRadianPerMeter < oneNewtonMeterPerRadianPerMeter);
+ Assert.False(twoNewtonMetersPerRadianPerMeter <= oneNewtonMeterPerRadianPerMeter);
+ }
+
+ [Fact]
+ public void CompareToIsImplemented()
+ {
+ RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1);
+ Assert.Equal(0, newtonmeterperradianpermeter.CompareTo(newtonmeterperradianpermeter));
+ Assert.True(newtonmeterperradianpermeter.CompareTo(RotationalStiffnessPerLength.Zero) > 0);
+ Assert.True(RotationalStiffnessPerLength.Zero.CompareTo(newtonmeterperradianpermeter) < 0);
+ }
+
+ [Fact]
+ public void CompareToThrowsOnTypeMismatch()
+ {
+ RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1);
+ Assert.Throws(() => newtonmeterperradianpermeter.CompareTo(new object()));
+ }
+
+ [Fact]
+ public void CompareToThrowsOnNull()
+ {
+ RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1);
+ Assert.Throws(() => newtonmeterperradianpermeter.CompareTo(null));
+ }
+
+
+ [Fact]
+ public void EqualityOperators()
+ {
+ RotationalStiffnessPerLength a = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1);
+ RotationalStiffnessPerLength b = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(2);
+
+// ReSharper disable EqualExpressionComparison
+ Assert.True(a == a);
+ Assert.True(a != b);
+
+ Assert.False(a == b);
+ Assert.False(a != a);
+// ReSharper restore EqualExpressionComparison
+ }
+
+ [Fact]
+ public void EqualsIsImplemented()
+ {
+ RotationalStiffnessPerLength v = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1);
+ Assert.True(v.Equals(RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1), RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(NewtonMetersPerRadianPerMeterTolerance)));
+ Assert.False(v.Equals(RotationalStiffnessPerLength.Zero, RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(NewtonMetersPerRadianPerMeterTolerance)));
+ }
+
+ [Fact]
+ public void EqualsReturnsFalseOnTypeMismatch()
+ {
+ RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1);
+ Assert.False(newtonmeterperradianpermeter.Equals(new object()));
+ }
+
+ [Fact]
+ public void EqualsReturnsFalseOnNull()
+ {
+ RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1);
+ Assert.False(newtonmeterperradianpermeter.Equals(null));
+ }
+ }
+}
diff --git a/UnitsNet/CustomCode/Quantities/RotationalStiffness.extra.cs b/UnitsNet/CustomCode/Quantities/RotationalStiffness.extra.cs
index 3f6e023f94..f0246d2cad 100644
--- a/UnitsNet/CustomCode/Quantities/RotationalStiffness.extra.cs
+++ b/UnitsNet/CustomCode/Quantities/RotationalStiffness.extra.cs
@@ -37,6 +37,16 @@ public partial struct RotationalStiffness
{
return Torque.FromNewtonMeters(rotationalStiffness.NewtonMetersPerRadian * angle.Radians);
}
+
+ public static RotationalStiffnessPerLength operator /(RotationalStiffness rotationalStiffness, Length length)
+ {
+ return RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(rotationalStiffness.NewtonMetersPerRadian / length.Meters);
+ }
+
+ public static Length operator /(RotationalStiffness rotationalStiffness, RotationalStiffnessPerLength rotationalStiffnessPerLength)
+ {
+ return Length.FromMeters(rotationalStiffness.NewtonMetersPerRadian / rotationalStiffnessPerLength.NewtonMetersPerRadianPerMeter);
+ }
#endif
}
}
diff --git a/UnitsNet/CustomCode/Quantities/RotationalStiffnessPerLength.extra.cs b/UnitsNet/CustomCode/Quantities/RotationalStiffnessPerLength.extra.cs
new file mode 100644
index 0000000000..d097e65322
--- /dev/null
+++ b/UnitsNet/CustomCode/Quantities/RotationalStiffnessPerLength.extra.cs
@@ -0,0 +1,42 @@
+// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
+// https://github.com/angularsen/UnitsNet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+
+namespace UnitsNet
+{
+ // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components
+ // Public structures can't have any members other than public fields, and those fields must be value types or strings.
+ // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic.
+#if WINDOWS_UWP
+ public sealed partial class RotationalStiffnessPerLength
+#else
+ public partial struct RotationalStiffnessPerLength
+#endif
+ {
+ // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
+#if !WINDOWS_UWP
+ public static RotationalStiffness operator *(RotationalStiffnessPerLength rotationalStiffness, Length length)
+ {
+ return RotationalStiffness.FromNewtonMetersPerRadian(rotationalStiffness.NewtonMetersPerRadianPerMeter * length.Meters);
+ }
+#endif
+ }
+}
diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessPerLengthExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessPerLengthExtensions.g.cs
new file mode 100644
index 0000000000..19abcdef84
--- /dev/null
+++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessPerLengthExtensions.g.cs
@@ -0,0 +1,151 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on 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.NumberToRotationalStiffnessPerLength
+{
+ public static class NumberToRotationalStiffnessPerLengthExtensions
+ {
+ #region KilonewtonMeterPerRadianPerMeter
+
+ ///
+ public static RotationalStiffnessPerLength KilonewtonMetersPerRadianPerMeter(this int value) => RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength? KilonewtonMetersPerRadianPerMeter(this int? value) => RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength KilonewtonMetersPerRadianPerMeter(this long value) => RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength? KilonewtonMetersPerRadianPerMeter(this long? value) => RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength KilonewtonMetersPerRadianPerMeter(this double value) => RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength? KilonewtonMetersPerRadianPerMeter(this double? value) => RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength KilonewtonMetersPerRadianPerMeter(this float value) => RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength? KilonewtonMetersPerRadianPerMeter(this float? value) => RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength KilonewtonMetersPerRadianPerMeter(this decimal value) => RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(Convert.ToDouble(value));
+
+ ///
+ public static RotationalStiffnessPerLength? KilonewtonMetersPerRadianPerMeter(this decimal? value) => RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value));
+
+ #endregion
+
+ #region MeganewtonMeterPerRadianPerMeter
+
+ ///
+ public static RotationalStiffnessPerLength MeganewtonMetersPerRadianPerMeter(this int value) => RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength? MeganewtonMetersPerRadianPerMeter(this int? value) => RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength MeganewtonMetersPerRadianPerMeter(this long value) => RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength? MeganewtonMetersPerRadianPerMeter(this long? value) => RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength MeganewtonMetersPerRadianPerMeter(this double value) => RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength? MeganewtonMetersPerRadianPerMeter(this double? value) => RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength MeganewtonMetersPerRadianPerMeter(this float value) => RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength? MeganewtonMetersPerRadianPerMeter(this float? value) => RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength MeganewtonMetersPerRadianPerMeter(this decimal value) => RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(Convert.ToDouble(value));
+
+ ///
+ public static RotationalStiffnessPerLength? MeganewtonMetersPerRadianPerMeter(this decimal? value) => RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value));
+
+ #endregion
+
+ #region NewtonMeterPerRadianPerMeter
+
+ ///
+ public static RotationalStiffnessPerLength NewtonMetersPerRadianPerMeter(this int value) => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength? NewtonMetersPerRadianPerMeter(this int? value) => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength NewtonMetersPerRadianPerMeter(this long value) => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength? NewtonMetersPerRadianPerMeter(this long? value) => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength NewtonMetersPerRadianPerMeter(this double value) => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength? NewtonMetersPerRadianPerMeter(this double? value) => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength NewtonMetersPerRadianPerMeter(this float value) => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength? NewtonMetersPerRadianPerMeter(this float? value) => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(value);
+
+ ///
+ public static RotationalStiffnessPerLength NewtonMetersPerRadianPerMeter(this decimal value) => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(Convert.ToDouble(value));
+
+ ///
+ public static RotationalStiffnessPerLength? NewtonMetersPerRadianPerMeter(this decimal? value) => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value));
+
+ #endregion
+
+ }
+}
+#endif
diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs
new file mode 100644
index 0000000000..c326ceef7c
--- /dev/null
+++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs
@@ -0,0 +1,877 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on 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;
+
+// ReSharper disable once CheckNamespace
+
+namespace UnitsNet
+{
+ ///
+ /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness
+ ///
+ // ReSharper disable once PartialTypeWithSinglePart
+
+ // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components
+ // Public structures can't have any members other than public fields, and those fields must be value types or strings.
+ // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic.
+#if WINDOWS_UWP
+ public sealed partial class RotationalStiffnessPerLength
+#else
+ public partial struct RotationalStiffnessPerLength : IComparable, IComparable
+#endif
+ {
+ ///
+ /// The numeric value this quantity was constructed with.
+ ///
+ private readonly double _value;
+
+ ///
+ /// The unit this quantity was constructed with.
+ ///
+ private readonly RotationalStiffnessPerLengthUnit? _unit;
+
+ ///
+ /// The numeric value this quantity was constructed with.
+ ///
+#if WINDOWS_UWP
+ public double Value => Convert.ToDouble(_value);
+#else
+ public double Value => _value;
+#endif
+
+ ///
+ /// The unit this quantity was constructed with -or- if default ctor was used.
+ ///
+ public RotationalStiffnessPerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+
+ // Windows Runtime Component requires a default constructor
+#if WINDOWS_UWP
+ public RotationalStiffnessPerLength()
+ {
+ _value = 0;
+ _unit = BaseUnit;
+ }
+#endif
+
+ [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")]
+ public RotationalStiffnessPerLength(double newtonmetersperradianpermeter)
+ {
+ _value = Convert.ToDouble(newtonmetersperradianpermeter);
+ _unit = BaseUnit;
+ }
+
+ ///
+ /// Creates the quantity with the given numeric value and unit.
+ ///
+ /// Numeric value.
+ /// Unit representation.
+ /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.
+#if WINDOWS_UWP
+ private
+#else
+ public
+#endif
+ RotationalStiffnessPerLength(double numericValue, RotationalStiffnessPerLengthUnit unit)
+ {
+ _value = numericValue;
+ _unit = unit;
+ }
+
+ // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
+ ///
+ /// Creates the quantity with the given value assuming the base unit NewtonMeterPerRadianPerMeter.
+ ///
+ /// Value assuming base unit NewtonMeterPerRadianPerMeter.
+#if WINDOWS_UWP
+ private
+#else
+ [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")]
+ public
+#endif
+ RotationalStiffnessPerLength(long newtonmetersperradianpermeter) : this(Convert.ToDouble(newtonmetersperradianpermeter), BaseUnit) { }
+
+ // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
+ // Windows Runtime Component does not support decimal type
+ ///
+ /// Creates the quantity with the given value assuming the base unit NewtonMeterPerRadianPerMeter.
+ ///
+ /// Value assuming base unit NewtonMeterPerRadianPerMeter.
+#if WINDOWS_UWP
+ private
+#else
+ [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")]
+ public
+#endif
+ RotationalStiffnessPerLength(decimal newtonmetersperradianpermeter) : this(Convert.ToDouble(newtonmetersperradianpermeter), BaseUnit) { }
+
+ #region Properties
+
+ ///
+ /// The of this quantity.
+ ///
+ public static QuantityType QuantityType => QuantityType.RotationalStiffnessPerLength;
+
+ ///
+ /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value.
+ ///
+ public static RotationalStiffnessPerLengthUnit BaseUnit => RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter;
+
+ ///
+ /// All units of measurement for the RotationalStiffnessPerLength quantity.
+ ///
+ public static RotationalStiffnessPerLengthUnit[] Units { get; } = Enum.GetValues(typeof(RotationalStiffnessPerLengthUnit)).Cast().ToArray();
+ ///
+ /// Get RotationalStiffnessPerLength in KilonewtonMetersPerRadianPerMeter.
+ ///
+ public double KilonewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter);
+ ///
+ /// Get RotationalStiffnessPerLength in MeganewtonMetersPerRadianPerMeter.
+ ///
+ public double MeganewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter);
+ ///
+ /// Get RotationalStiffnessPerLength in NewtonMetersPerRadianPerMeter.
+ ///
+ public double NewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter);
+
+ #endregion
+
+ #region Static
+
+ public static RotationalStiffnessPerLength Zero => new RotationalStiffnessPerLength(0, BaseUnit);
+
+ ///
+ /// Get RotationalStiffnessPerLength from KilonewtonMetersPerRadianPerMeter.
+ ///
+#if WINDOWS_UWP
+ [Windows.Foundation.Metadata.DefaultOverload]
+ public static RotationalStiffnessPerLength FromKilonewtonMetersPerRadianPerMeter(double kilonewtonmetersperradianpermeter)
+#else
+ public static RotationalStiffnessPerLength FromKilonewtonMetersPerRadianPerMeter(QuantityValue kilonewtonmetersperradianpermeter)
+#endif
+ {
+ double value = (double) kilonewtonmetersperradianpermeter;
+ return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter);
+ }
+
+ ///
+ /// Get RotationalStiffnessPerLength from MeganewtonMetersPerRadianPerMeter.
+ ///
+#if WINDOWS_UWP
+ [Windows.Foundation.Metadata.DefaultOverload]
+ public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter(double meganewtonmetersperradianpermeter)
+#else
+ public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter(QuantityValue meganewtonmetersperradianpermeter)
+#endif
+ {
+ double value = (double) meganewtonmetersperradianpermeter;
+ return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter);
+ }
+
+ ///
+ /// Get RotationalStiffnessPerLength from NewtonMetersPerRadianPerMeter.
+ ///
+#if WINDOWS_UWP
+ [Windows.Foundation.Metadata.DefaultOverload]
+ public static RotationalStiffnessPerLength FromNewtonMetersPerRadianPerMeter(double newtonmetersperradianpermeter)
+#else
+ public static RotationalStiffnessPerLength FromNewtonMetersPerRadianPerMeter(QuantityValue newtonmetersperradianpermeter)
+#endif
+ {
+ double value = (double) newtonmetersperradianpermeter;
+ return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter);
+ }
+
+ // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx
+#if !WINDOWS_UWP
+ ///
+ /// Get nullable RotationalStiffnessPerLength from nullable KilonewtonMetersPerRadianPerMeter.
+ ///
+ public static RotationalStiffnessPerLength? FromKilonewtonMetersPerRadianPerMeter(QuantityValue? kilonewtonmetersperradianpermeter)
+ {
+ if (kilonewtonmetersperradianpermeter.HasValue)
+ {
+ return FromKilonewtonMetersPerRadianPerMeter(kilonewtonmetersperradianpermeter.Value);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ ///
+ /// Get nullable RotationalStiffnessPerLength from nullable MeganewtonMetersPerRadianPerMeter.
+ ///
+ public static RotationalStiffnessPerLength? FromMeganewtonMetersPerRadianPerMeter(QuantityValue? meganewtonmetersperradianpermeter)
+ {
+ if (meganewtonmetersperradianpermeter.HasValue)
+ {
+ return FromMeganewtonMetersPerRadianPerMeter(meganewtonmetersperradianpermeter.Value);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ ///
+ /// Get nullable RotationalStiffnessPerLength from nullable NewtonMetersPerRadianPerMeter.
+ ///
+ public static RotationalStiffnessPerLength? FromNewtonMetersPerRadianPerMeter(QuantityValue? newtonmetersperradianpermeter)
+ {
+ if (newtonmetersperradianpermeter.HasValue)
+ {
+ return FromNewtonMetersPerRadianPerMeter(newtonmetersperradianpermeter.Value);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+#endif
+
+ ///
+ /// Dynamically convert from value and unit enum to .
+ ///
+ /// Value to convert from.
+ /// Unit to convert from.
+ /// RotationalStiffnessPerLength unit value.
+#if WINDOWS_UWP
+ // Fix name conflict with parameter "value"
+ [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")]
+ public static RotationalStiffnessPerLength From(double value, RotationalStiffnessPerLengthUnit fromUnit)
+#else
+ public static RotationalStiffnessPerLength From(QuantityValue value, RotationalStiffnessPerLengthUnit fromUnit)
+#endif
+ {
+ return new RotationalStiffnessPerLength((double)value, fromUnit);
+ }
+
+ // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx
+#if !WINDOWS_UWP
+ ///
+ /// Dynamically convert from value and unit enum to .
+ ///
+ /// Value to convert from.
+ /// Unit to convert from.
+ /// RotationalStiffnessPerLength unit value.
+ public static RotationalStiffnessPerLength? From(QuantityValue? value, RotationalStiffnessPerLengthUnit fromUnit)
+ {
+ if (!value.HasValue)
+ {
+ return null;
+ }
+
+ return new RotationalStiffnessPerLength((double)value.Value, fromUnit);
+ }
+#endif
+
+ ///
+ /// Get unit abbreviation string.
+ ///
+ /// Unit to get abbreviation for.
+ /// Unit abbreviation string.
+ [UsedImplicitly]
+ public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit)
+ {
+ return GetAbbreviation(unit, null);
+ }
+
+ ///
+ /// Get unit abbreviation string.
+ ///
+ /// Unit to get abbreviation for.
+#if WINDOWS_UWP
+ /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture.
+#else
+ /// Format to use for localization. Defaults to .
+#endif
+ /// Unit abbreviation string.
+ [UsedImplicitly]
+ public static string GetAbbreviation(
+ RotationalStiffnessPerLengthUnit unit,
+#if WINDOWS_UWP
+ [CanBeNull] string cultureName)
+#else
+ [CanBeNull] IFormatProvider provider)
+#endif
+ {
+#if WINDOWS_UWP
+ // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
+ IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName);
+#else
+ provider = provider ?? UnitSystem.DefaultCulture;
+#endif
+
+ return UnitSystem.GetCached(provider).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 RotationalStiffnessPerLength operator -(RotationalStiffnessPerLength right)
+ {
+ return new RotationalStiffnessPerLength(-right.Value, right.Unit);
+ }
+
+ public static RotationalStiffnessPerLength operator +(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right)
+ {
+ return new RotationalStiffnessPerLength(left.Value + right.AsBaseNumericType(left.Unit), left.Unit);
+ }
+
+ public static RotationalStiffnessPerLength operator -(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right)
+ {
+ return new RotationalStiffnessPerLength(left.Value - right.AsBaseNumericType(left.Unit), left.Unit);
+ }
+
+ public static RotationalStiffnessPerLength operator *(double left, RotationalStiffnessPerLength right)
+ {
+ return new RotationalStiffnessPerLength(left * right.Value, right.Unit);
+ }
+
+ public static RotationalStiffnessPerLength operator *(RotationalStiffnessPerLength left, double right)
+ {
+ return new RotationalStiffnessPerLength(left.Value * right, left.Unit);
+ }
+
+ public static RotationalStiffnessPerLength operator /(RotationalStiffnessPerLength left, double right)
+ {
+ return new RotationalStiffnessPerLength(left.Value / right, left.Unit);
+ }
+
+ public static double operator /(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right)
+ {
+ return left.NewtonMetersPerRadianPerMeter / right.NewtonMetersPerRadianPerMeter;
+ }
+#endif
+
+ #endregion
+
+ #region Equality / IComparable
+
+ public int CompareTo(object obj)
+ {
+ if (obj == null) throw new ArgumentNullException("obj");
+ if (!(obj is RotationalStiffnessPerLength)) throw new ArgumentException("Expected type RotationalStiffnessPerLength.", "obj");
+ return CompareTo((RotationalStiffnessPerLength) obj);
+ }
+
+ // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
+#if WINDOWS_UWP
+ internal
+#else
+ public
+#endif
+ int CompareTo(RotationalStiffnessPerLength other)
+ {
+ return AsBaseUnitNewtonMetersPerRadianPerMeter().CompareTo(other.AsBaseUnitNewtonMetersPerRadianPerMeter());
+ }
+
+ // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
+#if !WINDOWS_UWP
+ public static bool operator <=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right)
+ {
+ return left.Value <= right.AsBaseNumericType(left.Unit);
+ }
+
+ public static bool operator >=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right)
+ {
+ return left.Value >= right.AsBaseNumericType(left.Unit);
+ }
+
+ public static bool operator <(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right)
+ {
+ return left.Value < right.AsBaseNumericType(left.Unit);
+ }
+
+ public static bool operator >(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right)
+ {
+ return left.Value > right.AsBaseNumericType(left.Unit);
+ }
+
+ [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")]
+ public static bool operator ==(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right)
+ {
+ // ReSharper disable once CompareOfFloatsByEqualityOperator
+ return left.Value == right.AsBaseNumericType(left.Unit);
+ }
+
+ [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")]
+ public static bool operator !=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right)
+ {
+ // ReSharper disable once CompareOfFloatsByEqualityOperator
+ return left.Value != right.AsBaseNumericType(left.Unit);
+ }
+#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 AsBaseUnitNewtonMetersPerRadianPerMeter().Equals(((RotationalStiffnessPerLength) obj).AsBaseUnitNewtonMetersPerRadianPerMeter());
+ }
+
+ ///
+ /// Compare equality to another RotationalStiffnessPerLength by specifying a max allowed difference.
+ /// Note that it is advised against specifying zero difference, due to the nature
+ /// of floating point operations and using System.Double internally.
+ ///
+ /// Other quantity to compare to.
+ /// Max error allowed.
+ /// True if the difference between the two values is not greater than the specified max.
+ public bool Equals(RotationalStiffnessPerLength other, RotationalStiffnessPerLength maxError)
+ {
+ return Math.Abs(AsBaseUnitNewtonMetersPerRadianPerMeter() - other.AsBaseUnitNewtonMetersPerRadianPerMeter()) <= maxError.AsBaseUnitNewtonMetersPerRadianPerMeter();
+ }
+
+ public override int GetHashCode()
+ {
+ return new { Value, Unit }.GetHashCode();
+ }
+
+ #endregion
+
+ #region Conversion
+
+ ///
+ /// Convert to the unit representation .
+ ///
+ /// Value converted to the specified unit.
+ public double As(RotationalStiffnessPerLengthUnit unit)
+ {
+ if (Unit == unit)
+ {
+ return (double)Value;
+ }
+
+ double baseUnitValue = AsBaseUnitNewtonMetersPerRadianPerMeter();
+
+ switch (unit)
+ {
+ case RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter: return (baseUnitValue) / 1e3d;
+ case RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter: return (baseUnitValue) / 1e6d;
+ case RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter: return baseUnitValue;
+
+ 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 RotationalStiffnessPerLength Parse(string str)
+ {
+ return Parse(str, null);
+ }
+
+ ///
+ /// Parse a string with one or two quantities of the format "<quantity> <unit>".
+ ///
+ /// String to parse. Typically in the form: {number} {unit}
+#if WINDOWS_UWP
+ /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture.
+#else
+ /// Format to use when parsing number and unit. Defaults to .
+#endif
+ ///
+ /// Length.Parse("5.5 m", new CultureInfo("en-US"));
+ ///
+ /// The value of 'str' cannot be null.
+ ///
+ /// Expected string to have one or two pairs of quantity and unit in the format
+ /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in"
+ ///
+ ///
+ /// More than one unit is represented by the specified unit abbreviation.
+ /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of
+ /// , and .
+ ///
+ ///
+ /// If anything else goes wrong, typically due to a bug or unhandled case.
+ /// We wrap exceptions in to allow you to distinguish
+ /// Units.NET exceptions from other exceptions.
+ ///
+ public static RotationalStiffnessPerLength Parse(
+ string str,
+#if WINDOWS_UWP
+ [CanBeNull] string cultureName)
+#else
+ [CanBeNull] IFormatProvider provider)
+#endif
+ {
+ if (str == null) throw new ArgumentNullException("str");
+
+#if WINDOWS_UWP
+ // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
+ IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName);
+#else
+ provider = provider ?? UnitSystem.DefaultCulture;
+#endif
+
+ return QuantityParser.Parse(str, provider,
+ delegate(string value, string unit, IFormatProvider formatProvider2)
+ {
+ double parsedValue = double.Parse(value, formatProvider2);
+ RotationalStiffnessPerLengthUnit parsedUnit = ParseUnit(unit, formatProvider2);
+ return From(parsedValue, parsedUnit);
+ }, (x, y) => FromNewtonMetersPerRadianPerMeter(x.NewtonMetersPerRadianPerMeter + y.NewtonMetersPerRadianPerMeter));
+ }
+
+ ///
+ /// Try to parse a string with one or two quantities of the format "<quantity> <unit>".
+ ///
+ /// String to parse. Typically in the form: {number} {unit}
+ /// Resulting unit quantity if successful.
+ ///
+ /// Length.Parse("5.5 m", new CultureInfo("en-US"));
+ ///
+ public static bool TryParse([CanBeNull] string str, out RotationalStiffnessPerLength result)
+ {
+ return TryParse(str, null, out result);
+ }
+
+ ///
+ /// Try to parse a string with one or two quantities of the format "<quantity> <unit>".
+ ///
+ /// String to parse. Typically in the form: {number} {unit}
+#if WINDOWS_UWP
+ /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture.
+#else
+ /// Format to use when parsing number and unit. Defaults to .
+#endif
+ /// Resulting unit quantity if successful.
+ ///
+ /// Length.Parse("5.5 m", new CultureInfo("en-US"));
+ ///
+ public static bool TryParse(
+ [CanBeNull] string str,
+#if WINDOWS_UWP
+ [CanBeNull] string cultureName,
+#else
+ [CanBeNull] IFormatProvider provider,
+#endif
+ out RotationalStiffnessPerLength result)
+ {
+#if WINDOWS_UWP
+ // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
+ IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName);
+#else
+ provider = provider ?? UnitSystem.DefaultCulture;
+#endif
+ try
+ {
+
+ result = Parse(
+ str,
+#if WINDOWS_UWP
+ cultureName);
+#else
+ provider);
+#endif
+
+ return true;
+ }
+ catch
+ {
+ result = default(RotationalStiffnessPerLength);
+ return false;
+ }
+ }
+
+ ///
+ /// Parse a unit string.
+ ///
+ /// String to parse. Typically in the form: {number} {unit}
+ ///
+ /// Length.ParseUnit("m", new CultureInfo("en-US"));
+ ///
+ /// The value of 'str' cannot be null.
+ /// Error parsing string.
+ public static RotationalStiffnessPerLengthUnit ParseUnit(string str)
+ {
+ return ParseUnit(str, (IFormatProvider)null);
+ }
+
+ ///
+ /// Parse a unit string.
+ ///
+ /// String to parse. Typically in the form: {number} {unit}
+ /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture.
+ ///
+ /// Length.ParseUnit("m", new CultureInfo("en-US"));
+ ///
+ /// The value of 'str' cannot be null.
+ /// Error parsing string.
+ [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")]
+ public static RotationalStiffnessPerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName)
+ {
+ return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName));
+ }
+
+ ///
+ /// Parse a unit string.
+ ///
+ /// String to parse. Typically in the form: {number} {unit}
+ /// Format to use when parsing number and unit. Defaults to .
+ ///
+ /// Length.ParseUnit("m", new CultureInfo("en-US"));
+ ///
+ /// The value of 'str' cannot be null.
+ /// Error parsing string.
+
+ // Windows 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 RotationalStiffnessPerLengthUnit ParseUnit(string str, IFormatProvider provider = null)
+ {
+ if (str == null) throw new ArgumentNullException("str");
+
+ var unitSystem = UnitSystem.GetCached(provider);
+ var unit = unitSystem.Parse(str.Trim());
+
+ if (unit == RotationalStiffnessPerLengthUnit.Undefined)
+ {
+ var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalStiffnessPerLengthUnit.");
+ newEx.Data["input"] = str;
+ newEx.Data["provider"] = provider?.ToString() ?? "(null)";
+ throw newEx;
+ }
+
+ return unit;
+ }
+
+ #endregion
+
+ [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")]
+ ///
+ /// Set the default unit used by ToString(). Default is NewtonMeterPerRadianPerMeter
+ ///
+ public static RotationalStiffnessPerLengthUnit ToStringDefaultUnit { get; set; } = RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter;
+
+ ///
+ /// Get default string representation of value and unit.
+ ///
+ /// String representation.
+ public override string ToString()
+ {
+ return ToString(Unit);
+ }
+
+ ///
+ /// Get string representation of value and unit. Using current UI culture and two significant digits after radix.
+ ///
+ /// Unit representation to use.
+ /// String representation.
+ public string ToString(RotationalStiffnessPerLengthUnit unit)
+ {
+ return ToString(unit, null, 2);
+ }
+
+ ///
+ /// Get string representation of value and unit. Using two significant digits after radix.
+ ///
+ /// Unit representation to use.
+#if WINDOWS_UWP
+ /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture.
+#else
+ /// Format to use for localization and number formatting. Defaults to .
+#endif
+ /// String representation.
+ public string ToString(
+ RotationalStiffnessPerLengthUnit unit,
+#if WINDOWS_UWP
+ [CanBeNull] string cultureName)
+#else
+ [CanBeNull] IFormatProvider provider)
+#endif
+ {
+ return ToString(
+ unit,
+#if WINDOWS_UWP
+ cultureName,
+#else
+ provider,
+#endif
+ 2);
+ }
+
+ ///
+ /// Get string representation of value and unit.
+ ///
+ /// Unit representation to use.
+#if WINDOWS_UWP
+ /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture.
+#else
+ /// Format to use for localization and number formatting. Defaults to .
+#endif
+ /// The number of significant digits after the radix point.
+ /// String representation.
+ [UsedImplicitly]
+ public string ToString(
+ RotationalStiffnessPerLengthUnit unit,
+#if WINDOWS_UWP
+ [CanBeNull] string cultureName,
+#else
+ [CanBeNull] IFormatProvider provider,
+#endif
+ int significantDigitsAfterRadix)
+ {
+ double value = As(unit);
+ string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix);
+ return ToString(
+ unit,
+#if WINDOWS_UWP
+ cultureName,
+#else
+ provider,
+#endif
+ format);
+ }
+
+ ///
+ /// Get string representation of value and unit.
+ ///
+#if WINDOWS_UWP
+ /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture.
+#else
+ /// Format to use for localization and number formatting. Defaults to .
+#endif
+ /// Unit representation to use.
+ /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively."
+ /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1.
+ /// String representation.
+ [UsedImplicitly]
+ public string ToString(
+ RotationalStiffnessPerLengthUnit unit,
+#if WINDOWS_UWP
+ [CanBeNull] string cultureName,
+#else
+ [CanBeNull] IFormatProvider provider,
+#endif
+ [NotNull] string format,
+ [NotNull] params object[] args)
+ {
+ if (format == null) throw new ArgumentNullException(nameof(format));
+ if (args == null) throw new ArgumentNullException(nameof(args));
+
+#if WINDOWS_UWP
+ // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
+ IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName);
+#else
+ provider = provider ?? UnitSystem.DefaultCulture;
+#endif
+
+ double value = As(unit);
+ object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args);
+ return string.Format(provider, format, formatArgs);
+ }
+
+ ///
+ /// Represents the largest possible value of RotationalStiffnessPerLength
+ ///
+ public static RotationalStiffnessPerLength MaxValue => new RotationalStiffnessPerLength(double.MaxValue, BaseUnit);
+
+ ///
+ /// Represents the smallest possible value of RotationalStiffnessPerLength
+ ///
+ public static RotationalStiffnessPerLength MinValue => new RotationalStiffnessPerLength(double.MinValue, BaseUnit);
+
+ ///
+ /// Converts the current value + unit to the base unit.
+ /// This is typically the first step in converting from one unit to another.
+ ///
+ /// The value in the base unit representation.
+ private double AsBaseUnitNewtonMetersPerRadianPerMeter()
+ {
+ if (Unit == RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter) { return _value; }
+
+ switch (Unit)
+ {
+ case RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter: return (_value) * 1e3d;
+ case RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter: return (_value) * 1e6d;
+ case RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter: return _value;
+ default:
+ throw new NotImplementedException("Unit not implemented: " + Unit);
+ }
+ }
+
+ /// Convenience method for working with internal numeric type.
+ private double AsBaseNumericType(RotationalStiffnessPerLengthUnit unit) => Convert.ToDouble(As(unit));
+ }
+}
diff --git a/UnitsNet/GeneratedCode/QuantityType.g.cs b/UnitsNet/GeneratedCode/QuantityType.g.cs
index 1074f8ae48..6ad3f14e12 100644
--- a/UnitsNet/GeneratedCode/QuantityType.g.cs
+++ b/UnitsNet/GeneratedCode/QuantityType.g.cs
@@ -120,6 +120,7 @@ public enum QuantityType
RotationalAcceleration,
RotationalSpeed,
RotationalStiffness,
+ RotationalStiffnessPerLength,
SolidAngle,
SpecificEnergy,
SpecificEntropy,
diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs
index 7dccee08c9..4ebf01e588 100644
--- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs
+++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs
@@ -3276,6 +3276,25 @@ private static readonly ReadOnlyCollection DefaultLocalization
new AbbreviationsForCulture("en-US", "N·m/rad", "Nm/rad"),
}),
}),
+ new UnitLocalization(typeof (RotationalStiffnessPerLengthUnit),
+ new[]
+ {
+ new CulturesForEnumValue((int) RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter,
+ new[]
+ {
+ new AbbreviationsForCulture("en-US", "kN·m/rad/m"),
+ }),
+ new CulturesForEnumValue((int) RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter,
+ new[]
+ {
+ new AbbreviationsForCulture("en-US", "MN·m/rad/m"),
+ }),
+ new CulturesForEnumValue((int) RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter,
+ new[]
+ {
+ new AbbreviationsForCulture("en-US", "N·m/rad/m", "Nm/rad/m"),
+ }),
+ }),
new UnitLocalization(typeof (SolidAngleUnit),
new[]
{
diff --git a/UnitsNet/GeneratedCode/Units/RotationalStiffnessPerLengthUnit.g.cs b/UnitsNet/GeneratedCode/Units/RotationalStiffnessPerLengthUnit.g.cs
new file mode 100644
index 0000000000..3e56a0e0c4
--- /dev/null
+++ b/UnitsNet/GeneratedCode/Units/RotationalStiffnessPerLengthUnit.g.cs
@@ -0,0 +1,49 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by \generate-code.bat.
+//
+// Changes to this file will be lost when the code is regenerated.
+// The build server regenerates the code before each build and a pre-build
+// step will regenerate the code on 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 RotationalStiffnessPerLengthUnit
+ {
+ Undefined = 0,
+ KilonewtonMeterPerRadianPerMeter,
+ MeganewtonMeterPerRadianPerMeter,
+ NewtonMeterPerRadianPerMeter,
+ }
+}
diff --git a/UnitsNet/UnitDefinitions/RotationalStiffnessPerLength.json b/UnitsNet/UnitDefinitions/RotationalStiffnessPerLength.json
new file mode 100644
index 0000000000..6b54c12aa4
--- /dev/null
+++ b/UnitsNet/UnitDefinitions/RotationalStiffnessPerLength.json
@@ -0,0 +1,20 @@
+{
+ "Name": "RotationalStiffnessPerLength",
+ "BaseUnit": "NewtonMeterPerRadianPerMeter",
+ "XmlDoc": "https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness",
+ "Units": [
+ {
+ "SingularName": "NewtonMeterPerRadianPerMeter",
+ "PluralName": "NewtonMetersPerRadianPerMeter",
+ "FromUnitToBaseFunc": "x",
+ "FromBaseToUnitFunc": "x",
+ "Prefixes": [ "Kilo", "Mega" ],
+ "Localization": [
+ {
+ "Culture": "en-US",
+ "Abbreviations": [ "N·m/rad/m", "Nm/rad/m" ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file